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
931de505
Commit
931de505
authored
Jun 11, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Raise an compilation error when a cypclass inherits a data member from more than one path
parent
9631aff9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
5 deletions
+16
-5
Cython/Compiler/Builtin.py
Cython/Compiler/Builtin.py
+1
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-0
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+14
-5
No files found.
Cython/Compiler/Builtin.py
View file @
931de505
...
...
@@ -383,6 +383,7 @@ def inject_acthon_interfaces(self):
global
acthon_result_type
,
acthon_message_type
,
acthon_sync_type
,
acthon_queue_type
,
acthon_activable_type
def
init_scope
(
scope
):
scope
.
is_cpp_class_scope
=
1
scope
.
is_cyp_class_scope
=
1
scope
.
inherited_var_entries
=
[]
scope
.
inherited_type_entries
=
[]
...
...
Cython/Compiler/Nodes.py
View file @
931de505
...
...
@@ -1543,6 +1543,7 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode):
if
self
.
scope
is
None
and
self
.
attributes
is
not
None
:
scope
=
CppClassScope
(
self
.
name
,
env
,
templates
=
template_names
)
scope
.
is_cyp_class_scope
=
self
.
cypclass
self
.
scope
=
scope
scope
=
self
.
scope
...
...
Cython/Compiler/Symtab.py
View file @
931de505
...
...
@@ -501,7 +501,7 @@ class Scope(object):
# If we're not in a cypclass, any inherited method is visible
# until overloaded by a method with the same signature
if
not
(
self
.
type
and
self
.
type
.
is_cyp_class
)
:
if
not
self
.
is_cyp_class_scope
:
if
alt_entry
.
is_inherited
:
previous_alternative_indices
.
append
(
index
)
cpp_override_allowed
=
True
...
...
@@ -517,8 +517,16 @@ class Scope(object):
if
cpp_override_allowed
:
# C++ function/method overrides with different signatures are ok.
pass
elif
self
.
is_cpp_class_scope
and
entries
[
name
].
is_inherited
:
# Likewise ignore inherited methods with identical signatures
elif
self
.
is_cpp_class_scope
and
old_entry
.
is_inherited
:
# Likewise allow redeclaration of inherited cpp attributes
if
self
.
is_cyp_class_scope
and
not
(
old_entry
.
is_cfunction
or
old_entry
.
is_type
):
# Except for cypclass member variables
error
(
pos
,
"Cypclass data member '%s' is inherited more than once by cypclass '%s'."
%
(
name
,
self
.
name
))
old_entry
.
already_declared_here
()
cypclass_entry
=
self
.
outer_scope
.
lookup
(
self
.
name
)
if
cypclass_entry
:
error
(
cypclass_entry
.
pos
,
"Cypclass '%s' is declared here."
%
self
.
name
)
pass
elif
visibility
==
'extern'
:
# Silenced outside of "cdef extern" blocks, until we have a safe way to
...
...
@@ -526,7 +534,7 @@ class Scope(object):
warning
(
pos
,
"'%s' redeclared "
%
name
,
1
if
self
.
in_cinclude
else
0
)
elif
visibility
!=
'ignore'
:
error
(
pos
,
"'%s' redeclared "
%
name
)
entries
[
name
]
.
already_declared_here
()
old_entry
.
already_declared_here
()
entry
=
Entry
(
name
,
cname
,
type
,
pos
=
pos
)
entry
.
in_cinclude
=
self
.
in_cinclude
entry
.
create_wrapper
=
create_wrapper
...
...
@@ -2547,6 +2555,7 @@ class CppClassScope(Scope):
# Namespace of a C++ class.
is_cpp_class_scope
=
1
is_cyp_class_scope
=
0
default_constructor
=
None
type
=
None
...
...
@@ -2859,7 +2868,7 @@ class CppClassScope(Scope):
if
base_entry
.
name
in
self
.
entries
:
base_entry
.
name
# FIXME: is there anything to do in this case?
entry
=
self
.
declare
(
base_entry
.
name
,
base_entry
.
cname
,
base_entry_type
,
None
,
'extern'
)
base_entry_type
,
base_entry
.
pos
,
'extern'
)
entry
.
is_variable
=
1
entry
.
is_inherited
=
1
entry
.
is_cfunction
=
base_entry
.
is_cfunction
...
...
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