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
2c3e76e2
Commit
2c3e76e2
authored
Nov 04, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug #252, mangle illegal optional c argument names.
parent
f3fd7f91
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
9 deletions
+9
-9
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+1
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-3
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+3
-0
tests/bugs.txt
tests/bugs.txt
+0
-1
tests/run/bad_c_struct_T252.pyx
tests/run/bad_c_struct_T252.pyx
+4
-4
No files found.
Cython/Compiler/ExprNodes.py
View file @
2c3e76e2
...
@@ -2572,7 +2572,7 @@ class SimpleCallNode(CallNode):
...
@@ -2572,7 +2572,7 @@ class SimpleCallNode(CallNode):
for
formal_arg
,
actual_arg
in
args
[
expected_nargs
:
actual_nargs
]:
for
formal_arg
,
actual_arg
in
args
[
expected_nargs
:
actual_nargs
]:
code
.
putln
(
"%s.%s = %s;"
%
(
code
.
putln
(
"%s.%s = %s;"
%
(
self
.
opt_arg_struct
,
self
.
opt_arg_struct
,
f
ormal_arg
.
name
,
f
unc_type
.
opt_arg_cname
(
formal_arg
.
name
)
,
actual_arg
.
result_as
(
formal_arg
.
type
)))
actual_arg
.
result_as
(
formal_arg
.
type
)))
exc_checks
=
[]
exc_checks
=
[]
if
self
.
type
.
is_pyobject
:
if
self
.
type
.
is_pyobject
:
...
...
Cython/Compiler/Nodes.py
View file @
2c3e76e2
...
@@ -1473,13 +1473,11 @@ class CFuncDefNode(FuncDefNode):
...
@@ -1473,13 +1473,11 @@ class CFuncDefNode(FuncDefNode):
code
.
putln
(
'if (%s) {'
%
Naming
.
optional_args_cname
)
code
.
putln
(
'if (%s) {'
%
Naming
.
optional_args_cname
)
for
arg
in
self
.
args
:
for
arg
in
self
.
args
:
if
arg
.
default
:
if
arg
.
default
:
# FIXME: simple name prefixing doesn't work when
# argument name mangling is in place
code
.
putln
(
'if (%s->%sn > %s) {'
%
(
Naming
.
optional_args_cname
,
Naming
.
pyrex_prefix
,
i
))
code
.
putln
(
'if (%s->%sn > %s) {'
%
(
Naming
.
optional_args_cname
,
Naming
.
pyrex_prefix
,
i
))
declarator
=
arg
.
declarator
declarator
=
arg
.
declarator
while
not
hasattr
(
declarator
,
'name'
):
while
not
hasattr
(
declarator
,
'name'
):
declarator
=
declarator
.
base
declarator
=
declarator
.
base
code
.
putln
(
'%s = %s->%s;'
%
(
arg
.
cname
,
Naming
.
optional_args_cname
,
declarator
.
name
))
code
.
putln
(
'%s = %s->%s;'
%
(
arg
.
cname
,
Naming
.
optional_args_cname
,
self
.
type
.
opt_arg_cname
(
declarator
.
name
)
))
i
+=
1
i
+=
1
for
_
in
range
(
self
.
type
.
optional_arg_count
):
for
_
in
range
(
self
.
type
.
optional_arg_count
):
code
.
putln
(
'}'
)
code
.
putln
(
'}'
)
...
...
Cython/Compiler/PyrexTypes.py
View file @
2c3e76e2
...
@@ -1535,6 +1535,9 @@ class CFuncType(CType):
...
@@ -1535,6 +1535,9 @@ class CFuncType(CType):
def
signature_cast_string
(
self
):
def
signature_cast_string
(
self
):
s
=
self
.
declaration_code
(
"(*)"
,
with_calling_convention
=
False
)
s
=
self
.
declaration_code
(
"(*)"
,
with_calling_convention
=
False
)
return
'(%s)'
%
s
return
'(%s)'
%
s
def
opt_arg_cname
(
self
,
arg_name
):
return
self
.
op_arg_struct
.
base_type
.
scope
.
lookup
(
arg_name
).
cname
class
CFuncTypeArg
(
object
):
class
CFuncTypeArg
(
object
):
...
...
tests/bugs.txt
View file @
2c3e76e2
...
@@ -5,5 +5,4 @@ methodmangling_T5
...
@@ -5,5 +5,4 @@ methodmangling_T5
class_attribute_init_values_T18
class_attribute_init_values_T18
numpy_ValueError_T172
numpy_ValueError_T172
unsignedbehaviour_T184
unsignedbehaviour_T184
bad_c_struct_T252
missing_baseclass_in_predecl_T262
missing_baseclass_in_predecl_T262
tests/run/bad_c_struct_T252.pyx
View file @
2c3e76e2
cdef
cf
(
default
=
None
):
cdef
cf
(
default
=
None
):
return
default
return
default
cpdef
cpf
(
default
=
None
):
cpdef
cpf
(
default
=
100
):
"""
"""
>>> cpf()
>>> cpf()
None
100
>>> cpf(1)
>>> cpf(1)
1
1
>>> cpf(default=2)
>>> cpf(default=2)
...
@@ -13,10 +13,10 @@ cpdef cpf(default=None):
...
@@ -13,10 +13,10 @@ cpdef cpf(default=None):
default
=
cf
(
default
)
default
=
cf
(
default
)
return
default
return
default
def
pf
(
default
=
None
):
def
pf
(
default
=
100
):
"""
"""
>>> pf()
>>> pf()
None
100
>>> pf(1)
>>> pf(1)
1
1
>>> pf(default=2)
>>> pf(default=2)
...
...
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