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
04d4e1b7
Commit
04d4e1b7
authored
Oct 30, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
note on 'final' extension types
parent
7c530df0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
src/userguide/extension_types.rst
src/userguide/extension_types.rst
+19
-0
No files found.
src/userguide/extension_types.rst
View file @
04d4e1b7
...
...
@@ -316,6 +316,25 @@ inherit from multiple extension types provided that the usual Python rules for
multiple inheritance are followed (i.e. the C layouts of all the base classes
must be compatible).
Since Cython 0.13.1, there is a way to prevent extension types from
being subtyped in Python. This is done via the ``final`` directive,
usually set on an extension type using a decorator::
cimport cython
@cython.final
cdef class Parrot:
def done(self): pass
Trying to create a Python subclass from this type will raise a
:class:`TypeError` at runtime. Cython will also prevent subtyping a
final type inside of the same module, i.e. creating an extension type
that uses a final type as its base type will fail at compile time.
Note, however, that this restriction does not currently propagate to
other extension modules, so even final extension types can still be
subtyped at the C level by foreign code.
C methods
=========
Extension types can have C methods as well as Python methods. Like C
...
...
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