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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
6e7a55c1
Commit
6e7a55c1
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
3d918433
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 @
6e7a55c1
...
...
@@ -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 @
6e7a55c1
...
...
@@ -1540,6 +1540,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 @
6e7a55c1
...
...
@@ -529,7 +529,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
...
...
@@ -545,8 +545,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
...
...
@@ -554,7 +562,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
...
...
@@ -2654,6 +2662,7 @@ class CppClassScope(Scope):
# Namespace of a C++ class.
is_cpp_class_scope
=
1
is_cyp_class_scope
=
0
default_constructor
=
None
type
=
None
...
...
@@ -2965,7 +2974,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