Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xavier Thompson
cython
Commits
46bdd807
Commit
46bdd807
authored
Apr 12, 2020
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove dead fallback code: inspect.getcallargs() was added in Py2.7.
parent
8ee6e86e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
32 deletions
+1
-32
Cython/Build/Inline.py
Cython/Build/Inline.py
+1
-32
No files found.
Cython/Build/Inline.py
View file @
46bdd807
...
...
@@ -330,37 +330,6 @@ def extract_func_code(code):
return
'
\
n
'
.
join
(
module
),
' '
+
'
\
n
'
.
join
(
function
)
try
:
from
inspect
import
getcallargs
except
ImportError
:
def
getcallargs
(
func
,
*
arg_values
,
**
kwd_values
):
all
=
{}
args
,
varargs
,
kwds
,
defaults
=
inspect
.
getargspec
(
func
)
if
varargs
is
not
None
:
all
[
varargs
]
=
arg_values
[
len
(
args
):]
for
name
,
value
in
zip
(
args
,
arg_values
):
all
[
name
]
=
value
for
name
,
value
in
list
(
kwd_values
.
items
()):
if
name
in
args
:
if
name
in
all
:
raise
TypeError
(
"Duplicate argument %s"
%
name
)
all
[
name
]
=
kwd_values
.
pop
(
name
)
if
kwds
is
not
None
:
all
[
kwds
]
=
kwd_values
elif
kwd_values
:
raise
TypeError
(
"Unexpected keyword arguments: %s"
%
list
(
kwd_values
))
if
defaults
is
None
:
defaults
=
()
first_default
=
len
(
args
)
-
len
(
defaults
)
for
ix
,
name
in
enumerate
(
args
):
if
name
not
in
all
:
if
ix
>=
first_default
:
all
[
name
]
=
defaults
[
ix
-
first_default
]
else
:
raise
TypeError
(
"Missing argument: %s"
%
name
)
return
all
def
get_body
(
source
):
ix
=
source
.
index
(
':'
)
if
source
[:
5
]
==
'lambda'
:
...
...
@@ -378,7 +347,7 @@ class RuntimeCompiledFunction(object):
self
.
_body
=
get_body
(
inspect
.
getsource
(
f
))
def
__call__
(
self
,
*
args
,
**
kwds
):
all
=
getcallargs
(
self
.
_f
,
*
args
,
**
kwds
)
all
=
inspect
.
getcallargs
(
self
.
_f
,
*
args
,
**
kwds
)
if
IS_PY3
:
return
cython_inline
(
self
.
_body
,
locals
=
self
.
_f
.
__globals__
,
globals
=
self
.
_f
.
__globals__
,
**
all
)
else
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment