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
Boxiang Sun
cython
Commits
3257193a
Commit
3257193a
authored
Mar 29, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prevent tp_new() optimisation from breaking external types with known typeobj
parent
dd29ccbe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+3
-1
tests/run/tp_new_cimport.srctree
tests/run/tp_new_cimport.srctree
+1
-1
No files found.
Cython/Compiler/Optimize.py
View file @
3257193a
...
@@ -2189,7 +2189,9 @@ class OptimizeBuiltinCalls(Visitor.MethodDispatcherTransform):
...
@@ -2189,7 +2189,9 @@ class OptimizeBuiltinCalls(Visitor.MethodDispatcherTransform):
if
type_arg
.
type_entry
:
if
type_arg
.
type_entry
:
ext_type
=
type_arg
.
type_entry
.
type
ext_type
=
type_arg
.
type_entry
.
type
if
ext_type
.
is_extension_type
and
ext_type
.
typeobj_cname
:
if
(
ext_type
.
is_extension_type
and
ext_type
.
typeobj_cname
and
ext_type
.
scope
.
global_scope
()
==
self
.
current_env
().
global_scope
()):
# known type in current module
tp_slot
=
TypeSlots
.
ConstructorSlot
(
"tp_new"
,
'__new__'
)
tp_slot
=
TypeSlots
.
ConstructorSlot
(
"tp_new"
,
'__new__'
)
slot_func_cname
=
TypeSlots
.
get_slot_function
(
ext_type
.
scope
,
tp_slot
)
slot_func_cname
=
TypeSlots
.
get_slot_function
(
ext_type
.
scope
,
tp_slot
)
if
slot_func_cname
:
if
slot_func_cname
:
...
...
tests/run/tp_new_cimport.srctree
View file @
3257193a
...
@@ -42,7 +42,7 @@ def test_sub():
...
@@ -42,7 +42,7 @@ def test_sub():
######## a.pxd ########
######## a.pxd ########
cdef
class ExtTypeA
:
cdef
api class ExtTypeA[type ExtTypeA_Type, object ExtTypeAObject]
:
cdef readonly attrA
cdef readonly attrA
######## a.pyx ########
######## a.pyx ########
...
...
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