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
e3aec038
Commit
e3aec038
authored
Sep 11, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Generate code correctly for 'const' cypclasses"
This reverts commit
f6afb399
.
parent
b498f088
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
33 deletions
+10
-33
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+1
-1
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+1
-1
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+2
-18
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+5
-12
Cython/Compiler/TypeInference.py
Cython/Compiler/TypeInference.py
+1
-1
No files found.
Cython/Compiler/Code.py
View file @
e3aec038
...
@@ -842,7 +842,7 @@ class FunctionState(object):
...
@@ -842,7 +842,7 @@ class FunctionState(object):
A C string referring to the variable is returned.
A C string referring to the variable is returned.
"""
"""
if type.is_cv_qualified and not type.is_reference
and not type.is_cyp_class
:
if type.is_cv_qualified and not type.is_reference:
type = type.cv_base_type
type = type.cv_base_type
elif type.is_reference and not type.is_fake_reference:
elif type.is_reference and not type.is_fake_reference:
type = type.ref_base_type
type = type.ref_base_type
...
...
Cython/Compiler/ExprNodes.py
View file @
e3aec038
...
@@ -2099,7 +2099,7 @@ class NameNode(AtomicExprNode):
...
@@ -2099,7 +2099,7 @@ class NameNode(AtomicExprNode):
entry
=
self
.
entry
=
entry
.
as_variable
entry
=
self
.
entry
=
entry
.
as_variable
self
.
type
=
entry
.
type
self
.
type
=
entry
.
type
if
self
.
type
.
is_const
and
not
self
.
type
.
is_cyp_class
:
if
self
.
type
.
is_const
:
error
(
self
.
pos
,
"Assignment to const '%s'"
%
self
.
name
)
error
(
self
.
pos
,
"Assignment to const '%s'"
%
self
.
name
)
if
self
.
type
.
is_reference
:
if
self
.
type
.
is_reference
:
error
(
self
.
pos
,
"Assignment to reference '%s'"
%
self
.
name
)
error
(
self
.
pos
,
"Assignment to reference '%s'"
%
self
.
name
)
...
...
Cython/Compiler/PyrexTypes.py
View file @
e3aec038
...
@@ -1847,6 +1847,8 @@ class CConstOrVolatileType(BaseType):
...
@@ -1847,6 +1847,8 @@ class CConstOrVolatileType(BaseType):
def
cv_string
(
self
):
def
cv_string
(
self
):
cvstring
=
""
cvstring
=
""
if
self
.
is_cyp_class
:
return
cvstring
if
self
.
is_const
:
if
self
.
is_const
:
cvstring
=
"const "
+
cvstring
cvstring
=
"const "
+
cvstring
if
self
.
is_volatile
:
if
self
.
is_volatile
:
...
@@ -1864,18 +1866,9 @@ class CConstOrVolatileType(BaseType):
...
@@ -1864,18 +1866,9 @@ class CConstOrVolatileType(BaseType):
cv
=
self
.
cv_string
()
cv
=
self
.
cv_string
()
if
for_display
or
pyrex
:
if
for_display
or
pyrex
:
return
cv
+
self
.
cv_base_type
.
declaration_code
(
entity_code
,
for_display
,
dll_linkage
,
pyrex
)
return
cv
+
self
.
cv_base_type
.
declaration_code
(
entity_code
,
for_display
,
dll_linkage
,
pyrex
)
elif
self
.
cv_base_type
.
is_cyp_class
:
return
cv
+
self
.
cv_base_type
.
declaration_code
(
entity_code
,
for_display
,
dll_linkage
,
pyrex
)
else
:
else
:
return
self
.
cv_base_type
.
declaration_code
(
cv
+
entity_code
,
for_display
,
dll_linkage
,
pyrex
)
return
self
.
cv_base_type
.
declaration_code
(
cv
+
entity_code
,
for_display
,
dll_linkage
,
pyrex
)
def
empty_declaration_code
(
self
):
if
self
.
cv_base_type
.
is_cyp_class
:
cv
=
self
.
cv_string
()
return
cv
+
self
.
cv_base_type
.
empty_declaration_code
()
else
:
return
super
(
CConstOrVolatileType
,
self
).
empty_declaration_code
()
def
specialize
(
self
,
values
):
def
specialize
(
self
,
values
):
base_type
=
self
.
cv_base_type
.
specialize
(
values
)
base_type
=
self
.
cv_base_type
.
specialize
(
values
)
if
base_type
==
self
.
cv_base_type
:
if
base_type
==
self
.
cv_base_type
:
...
@@ -1903,15 +1896,6 @@ class CConstOrVolatileType(BaseType):
...
@@ -1903,15 +1896,6 @@ class CConstOrVolatileType(BaseType):
# Accept cv LHS <- non-cv RHS.
# Accept cv LHS <- non-cv RHS.
return
self
.
cv_base_type
.
same_as_resolved_type
(
other_type
)
return
self
.
cv_base_type
.
same_as_resolved_type
(
other_type
)
def
as_argument_type
(
self
):
if
self
.
is_cyp_class
:
# A const cypclass is actually a pointer to a const cypclass.
return
self
else
:
# This strips 'const' and 'volatile' qualifiers, which is not the documented goal
# but temporaries and Python function argument conversions rely on that.
return
self
.
cv_base_type
.
as_argument_type
()
def
__getattr__
(
self
,
name
):
def
__getattr__
(
self
,
name
):
return
getattr
(
self
.
cv_base_type
,
name
)
return
getattr
(
self
.
cv_base_type
,
name
)
...
...
Cython/Compiler/Symtab.py
View file @
e3aec038
...
@@ -3236,20 +3236,13 @@ class CConstOrVolatileScope(Scope):
...
@@ -3236,20 +3236,13 @@ class CConstOrVolatileScope(Scope):
self
.
base_type_scope
=
base_type_scope
self
.
base_type_scope
=
base_type_scope
self
.
is_const
=
is_const
self
.
is_const
=
is_const
self
.
is_volatile
=
is_volatile
self
.
is_volatile
=
is_volatile
self
.
cached_const_entries
=
{}
def
lookup_here
(
self
,
name
):
def
lookup_here
(
self
,
name
):
try
:
return
self
.
cached_const_entries
[
name
]
except
KeyError
:
entry
=
self
.
base_type_scope
.
lookup_here
(
name
)
entry
=
self
.
base_type_scope
.
lookup_here
(
name
)
if
entry
is
not
None
:
if
entry
is
not
None
:
entry
=
copy
.
copy
(
entry
)
entry
=
copy
.
copy
(
entry
)
entry
.
type
=
PyrexTypes
.
c_const_or_volatile_type
(
entry
.
type
=
PyrexTypes
.
c_const_or_volatile_type
(
entry
.
type
,
self
.
is_const
,
self
.
is_volatile
)
entry
.
type
,
self
.
is_const
,
self
.
is_volatile
)
# The entry must be cached because otherwise a new type is created at
# each lookup, which can cause type inference to reinfer forever.
self
.
cached_const_entries
[
name
]
=
entry
return
entry
return
entry
...
...
Cython/Compiler/TypeInference.py
View file @
e3aec038
...
@@ -536,7 +536,7 @@ def simply_type(result_type, pos):
...
@@ -536,7 +536,7 @@ def simply_type(result_type, pos):
result_type
=
result_type
.
checked_base_type
result_type
=
result_type
.
checked_base_type
if
result_type
.
is_reference
:
if
result_type
.
is_reference
:
result_type
=
result_type
.
ref_base_type
result_type
=
result_type
.
ref_base_type
if
result_type
.
is_cv_qualified
and
not
result_type
.
is_cyp_class
:
if
result_type
.
is_cv_qualified
:
result_type
=
result_type
.
cv_base_type
result_type
=
result_type
.
cv_base_type
if
result_type
.
is_cpp_class
:
if
result_type
.
is_cpp_class
:
result_type
.
check_nullary_constructor
(
pos
)
result_type
.
check_nullary_constructor
(
pos
)
...
...
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