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
12d628d7
Commit
12d628d7
authored
Oct 01, 2011
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bludgeon warning & fix argument unpacking closure leak
parent
3c13f13d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
11 deletions
+22
-11
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+3
-3
Cython/Utility/MemoryView.pyx
Cython/Utility/MemoryView.pyx
+19
-8
No files found.
Cython/Compiler/Nodes.py
View file @
12d628d7
...
...
@@ -2618,12 +2618,12 @@ class DefNode(FuncDefNode):
if
arg
.
type
.
is_pyobject
and
arg
.
entry
.
in_closure
:
code
.
put_var_giveref
(
arg
.
entry
)
def
generate_arg_assignment
(
self
,
arg
,
item
,
code
):
def
generate_arg_assignment
(
self
,
arg
,
item
,
code
,
incref_closure
=
True
):
if
arg
.
type
.
is_pyobject
:
if
arg
.
is_generic
:
item
=
PyrexTypes
.
typecast
(
arg
.
type
,
PyrexTypes
.
py_object_type
,
item
)
entry
=
arg
.
entry
if
entry
.
in_closure
:
if
incref_closure
and
entry
.
in_closure
:
code
.
put_incref
(
item
,
PyrexTypes
.
py_object_type
)
code
.
putln
(
"%s = %s;"
%
(
entry
.
cname
,
item
))
else
:
...
...
@@ -3035,7 +3035,7 @@ class DefNode(FuncDefNode):
for
i
,
arg
in
enumerate
(
all_args
):
if
arg
.
default
and
not
arg
.
type
.
is_pyobject
:
code
.
putln
(
"if (values[%d]) {"
%
i
)
self
.
generate_arg_assignment
(
arg
,
"values[%d]"
%
i
,
code
)
self
.
generate_arg_assignment
(
arg
,
"values[%d]"
%
i
,
code
,
incref_closure
=
False
)
if
arg
.
default
and
not
arg
.
type
.
is_pyobject
:
code
.
putln
(
'} else {'
)
code
.
putln
(
...
...
Cython/Utility/MemoryView.pyx
View file @
12d628d7
...
...
@@ -561,18 +561,29 @@ cdef memoryview memview_slice(memoryview memview, object indices):
dst
.
memview
=
p_src
.
memview
dst
.
data
=
p_src
.
data
# Put everything in temps to avoid this bloody warning:
# "Argument evaluation order in C function call is undefined and
# may not be as expected"
cdef
{{
memviewslice_name
}}
*
p_dst
=
&
dst
cdef
int
*
p_suboffset_dim
=
&
suboffset_dim
cdef
Py_ssize_t
start
,
stop
,
step
cdef
bint
have_start
,
have_stop
,
have_step
for
dim
,
index
in
enumerate
(
indices
):
if
PyIndex_Check
(
index
):
slice_memviewslice
(
p_src
,
&
dst
,
True
,
dim
,
new_ndim
,
&
suboffset_dim
,
slice_memviewslice
(
p_src
,
p_dst
,
True
,
dim
,
new_ndim
,
p_
suboffset_dim
,
index
,
0
,
0
,
0
,
0
,
0
,
False
)
else
:
slice_memviewslice
(
p_src
,
&
dst
,
True
,
dim
,
new_ndim
,
&
suboffset_dim
,
index
.
start
or
0
,
index
.
stop
or
0
,
index
.
step
or
0
,
index
.
start
is
not
None
,
index
.
stop
is
not
None
,
index
.
step
is
not
None
,
start
=
index
.
start
or
0
stop
=
index
.
stop
or
0
step
=
index
.
step
or
0
have_start
=
index
.
start
is
not
None
have_stop
=
index
.
stop
is
not
None
have_step
=
index
.
step
is
not
None
slice_memviewslice
(
p_src
,
p_dst
,
True
,
dim
,
new_ndim
,
p_suboffset_dim
,
start
,
stop
,
step
,
have_start
,
have_stop
,
have_step
,
True
)
new_ndim
+=
1
...
...
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