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
f7b2cfd1
Commit
f7b2cfd1
authored
Dec 11, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix type inference of qualified cypclass looping forever
parent
2b51fc1f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-0
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+17
-3
No files found.
Cython/Compiler/ExprNodes.py
View file @
f7b2cfd1
...
...
@@ -11379,6 +11379,8 @@ class ConsumeNode(ExprNode):
def
infer_type
(
self
,
env
):
operand_type
=
self
.
operand
.
infer_type
(
env
)
if
operand_type
.
is_cyp_class
:
if
operand_type
.
is_qualified_cyp_class
:
operand_type
=
operand_type
.
qual_base_type
return
PyrexTypes
.
cyp_class_qualified_type
(
operand_type
,
'iso~'
)
else
:
return
operand_type
...
...
Cython/Compiler/PyrexTypes.py
View file @
f7b2cfd1
...
...
@@ -4538,9 +4538,10 @@ def compute_mro_generic(cls):
return
mro_C3_merge
(
inputs
)
class
CypClassType
(
CppClassType
):
# _mro [CppClassType] or None the Method Resolution Order of this cypclass according to Python
# support_wrapper boolean whether this cypclass will be wrapped
# wrapper_type PyExtensionType or None the type of the cclass wrapper
# _mro [CppClassType] or None the Method Resolution Order of this cypclass
# support_wrapper boolean whether this cypclass will be wrapped
# wrapper_type PyExtensionType or None the type of the cclass wrapper
# _qualified_types {string: QualifiedCypclassType} a cache of qualified versions of this type
is_cyp_class
=
1
to_py_function
=
None
...
...
@@ -4553,6 +4554,7 @@ class CypClassType(CppClassType):
self
.
support_wrapper
=
False
self
.
wrapper_type
=
None
self
.
_wrapped_base_type
=
None
self
.
_qualified_types
=
{}
# iterate over the direct bases that support wrapping
def
iter_wrapped_base_types
(
self
):
...
...
@@ -4827,6 +4829,18 @@ class QualifiedCypclassType(BaseType):
'locked'
:
(
'locked'
,
'iso~'
),
}
def
__new__
(
cls
,
base_type
,
qualifier
):
# The qualified type is cached in the unqualified type to avoid duplicates.
try
:
return
base_type
.
_qualified_types
[
qualifier
]
except
KeyError
:
if
base_type
.
is_qualified_cyp_class
:
base_type
=
base_type
.
qual_base_type
qualified_type
=
BaseType
.
__new__
(
cls
)
qualified_type
.
__init__
(
base_type
,
qualifier
)
base_type
.
_qualified_types
[
qualifier
]
=
qualified_type
return
qualified_type
def
__init__
(
self
,
base_type
,
qualifier
):
assert
base_type
.
is_cyp_class
self
.
qual_base_type
=
base_type
...
...
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