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
Gwenaël Samain
cython
Commits
57b5f0cd
Commit
57b5f0cd
authored
Sep 10, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Py2.4 test fixes
parent
53457e15
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
8 deletions
+23
-8
tests/run/cyfunction.pyx
tests/run/cyfunction.pyx
+23
-8
No files found.
tests/run/cyfunction.pyx
View file @
57b5f0cd
...
...
@@ -93,6 +93,21 @@ def codeof(func):
else
:
return
func
.
func_code
def
varnamesof
(
func
):
code
=
codeof
(
func
)
varnames
=
code
.
co_varnames
if
sys
.
version_info
<
(
2
,
5
):
pos
=
{
'a'
:
0
,
'x'
:
1
,
'b'
:
2
,
'l'
:
3
,
'm'
:
4
}
varnames
=
tuple
(
sorted
(
varnames
,
key
=
pos
.
__getitem__
))
return
varnames
def
namesof
(
func
):
code
=
codeof
(
func
)
names
=
code
.
co_names
if
sys
.
version_info
<
(
2
,
5
):
names
=
()
return
names
def
cy_no_arg
():
l
=
m
=
1
def
cy_one_arg
(
a
):
...
...
@@ -117,11 +132,11 @@ def test_code():
no_arg
>>> print(codeof(cy_no_arg).co_name)
cy_no_arg
>>>
codeof(no_arg).co_names
>>>
namesof(no_arg)
()
>>> codeof(cy_no_arg).co_names
()
>>>
codeof(no_arg).co_varnames
>>>
varnamesof(no_arg)
('l', 'm')
>>> codeof(cy_no_arg).co_varnames
('l', 'm')
...
...
@@ -134,11 +149,11 @@ def test_code():
one_arg
>>> print(codeof(cy_one_arg).co_name)
cy_one_arg
>>>
codeof(one_arg).co_names
>>>
namesof(one_arg)
()
>>> codeof(cy_one_arg).co_names
()
>>>
codeof(one_arg).co_varnames
>>>
varnamesof(one_arg)
('a', 'l', 'm')
>>> codeof(cy_one_arg).co_varnames
('a', 'l', 'm')
...
...
@@ -147,11 +162,11 @@ def test_code():
2
>>> codeof(cy_two_args).co_argcount
2
>>>
codeof(two_args).co_names
>>>
namesof(two_args)
()
>>> codeof(cy_two_args).co_names
()
>>>
codeof(two_args).co_varnames
>>>
varnamesof(two_args)
('x', 'b', 'l', 'm')
>>> codeof(cy_two_args).co_varnames
('x', 'b', 'l', 'm')
...
...
@@ -160,11 +175,11 @@ def test_code():
2
>>> codeof(cy_default_args).co_argcount
2
>>>
codeof(default_args).co_names
>>>
namesof(default_args)
()
>>> codeof(cy_default_args).co_names
()
>>>
codeof(default_args).co_varnames
>>>
varnamesof(default_args)
('x', 'b', 'l', 'm')
>>> codeof(cy_default_args).co_varnames
('x', 'b', 'l', 'm')
...
...
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