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
23778224
Commit
23778224
authored
Dec 18, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix reference counting in cypclass constructors
parent
013eec6b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
3 deletions
+23
-3
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+23
-3
No files found.
Cython/Compiler/ModuleNode.py
View file @
23778224
...
...
@@ -1301,9 +1301,29 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
self
.
generate_cypclass_wrapper_allocation
(
code
,
type
.
wrapper_type
)
if
init_entry
:
init_entry
=
PyrexTypes
.
best_match
(
wrapper_arg_types
,
init_entry
.
all_alternatives
(),
None
)
if
init_entry
and
(
is_new_return_type
):
init_entry
=
PyrexTypes
.
best_match
(
wrapper_arg_types
,
init_entry
.
all_alternatives
(),
None
)
refcnt_op
=
None
if
new_entry
and
(
init_entry
and
is_new_return_type
):
refcnt_op
=
"Cy_INCREF"
elif
not
new_entry
and
not
(
init_entry
and
is_new_return_type
):
refcnt_op
=
"Cy_DECREF"
if
refcnt_op
:
for
arg
in
wrapper_type
.
args
[:
len
(
wrapper_type
.
args
)
-
wrapper_type
.
optional_arg_count
]:
if
arg
.
type
.
is_cyp_class
:
code
.
putln
(
"%s(%s);"
%
(
refcnt_op
,
arg
.
cname
))
if
wrapper_type
.
optional_arg_count
:
for
i
,
arg
in
enumerate
(
wrapper_entry
.
type
.
args
[
wrapper_type
.
optional_arg_count
:]):
if
arg
.
type
.
is_cyp_class
:
code
.
putln
(
"%s(%s->%s);"
%
(
refcnt_op
,
Naming
.
optional_args_cname
,
wrapper_entry
.
type
.
op_arg_struct
.
base_type
.
scope
.
var_entries
[
i
+
1
].
cname
)
)
if
init_entry
and
is_new_return_type
:
# Calling __init__
max_init_nargs
=
len
(
init_entry
.
type
.
args
)
...
...
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