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
Kirill Smelkov
cython
Commits
89983ec7
Commit
89983ec7
authored
Feb 24, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up ref-counting for default arguments (by Lisandro)
parent
4b6142dc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-1
tests/run/argdefault.pyx
tests/run/argdefault.pyx
+12
-0
No files found.
Cython/Compiler/Nodes.py
View file @
89983ec7
...
@@ -1241,7 +1241,7 @@ class FuncDefNode(StatNode, BlockNode):
...
@@ -1241,7 +1241,7 @@ class FuncDefNode(StatNode, BlockNode):
if
default
.
is_temp
and
default
.
type
.
is_pyobject
:
if
default
.
is_temp
and
default
.
type
.
is_pyobject
:
code
.
putln
(
"%s = 0;"
%
default
.
result
())
code
.
putln
(
"%s = 0;"
%
default
.
result
())
default
.
free_temps
(
code
)
default
.
free_temps
(
code
)
code
.
put_
giveref
(
arg
.
default_entry
.
cname
)
code
.
put_
var_giveref
(
arg
.
default_entry
)
# For Python class methods, create and store function object
# For Python class methods, create and store function object
if
self
.
assmt
:
if
self
.
assmt
:
self
.
assmt
.
generate_execution_code
(
code
)
self
.
assmt
.
generate_execution_code
(
code
)
...
...
tests/run/argdefault.pyx
View file @
89983ec7
...
@@ -28,6 +28,11 @@ __doc__ = u"""
...
@@ -28,6 +28,11 @@ __doc__ = u"""
<argdefault.Bla object at ...>
<argdefault.Bla object at ...>
>>> g5() #doctest: +ELLIPSIS
>>> g5() #doctest: +ELLIPSIS
<argdefault.Bla object at ...>
<argdefault.Bla object at ...>
>>> f6()
7
>>> g6()
7
"""
"""
GLB0
=
(
1
,
2
)
GLB0
=
(
1
,
2
)
...
@@ -76,3 +81,10 @@ def f5(Bla arg=GLB5):
...
@@ -76,3 +81,10 @@ def f5(Bla arg=GLB5):
return
arg
return
arg
def
g5
(
Bla
arg
=
Bla
()):
def
g5
(
Bla
arg
=
Bla
()):
return
arg
return
arg
cdef
int
GLB6
=
7
def
f6
(
int
arg
=
GLB6
):
return
arg
def
g6
(
int
arg
=
7
):
return
arg
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