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
3fcfc62d
Commit
3fcfc62d
authored
Oct 30, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prevent subtyping final types in Cython (inside of the same module)
parent
9b57b1c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletion
+19
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+6
-1
tests/errors/subtyping_final_class.pyx
tests/errors/subtyping_final_class.pyx
+13
-0
No files found.
Cython/Compiler/Nodes.py
View file @
3fcfc62d
...
...
@@ -3104,7 +3104,12 @@ class CClassDefNode(ClassDefNode):
elif
not
base_class_entry
.
type
.
is_extension_type
:
error
(
self
.
pos
,
"'%s' is not an extension type"
%
self
.
base_class_name
)
elif
not
base_class_entry
.
type
.
is_complete
():
error
(
self
.
pos
,
"Base class '%s' is incomplete"
%
self
.
base_class_name
)
error
(
self
.
pos
,
"Base class '%s' of type '%s' is incomplete"
%
(
self
.
base_class_name
,
self
.
class_name
))
elif
base_class_entry
.
type
.
scope
and
base_class_entry
.
type
.
scope
.
directives
and
\
base_class_entry
.
type
.
scope
.
directives
.
get
(
'final'
,
False
):
error
(
self
.
pos
,
"Base class '%s' of type '%s' is final"
%
(
self
.
base_class_name
,
self
.
class_name
))
else
:
self
.
base_type
=
base_class_entry
.
type
has_body
=
self
.
body
is
not
None
...
...
tests/errors/subtyping_final_class.pyx
0 → 100644
View file @
3fcfc62d
cimport
cython
@
cython
.
final
cdef
class
FinalClass
:
pass
cdef
class
SubType
(
FinalClass
):
pass
_ERRORS
=
"""
8:5: Base class 'FinalClass' of type 'SubType' is final
"""
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