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
4a99c52c
Commit
4a99c52c
authored
May 14, 2018
by
scoder
Committed by
GitHub
May 14, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2259 from gabrieldemarmiesse/transfer_checked_type_casts
transfered checked type casts
parents
b701fdb7
d08a9ad0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
docs/src/userguide/language_basics.rst
docs/src/userguide/language_basics.rst
+14
-0
No files found.
docs/src/userguide/language_basics.rst
View file @
4a99c52c
...
...
@@ -516,6 +516,20 @@ Sometimes Cython will complain unnecessarily, and sometimes it will fail to
detect a problem that exists. Ultimately, you need to understand the issue and
be careful what you do.
Checked Type Casts
------------------
A cast like ``<MyExtensionType>x`` will cast x to the class
``MyExtensionType`` without any checking at all.
To have a cast checked, use the syntax like: ``<MyExtensionType?>x``.
In this case, Cython will apply a runtime check that raises a ``TypeError``
if ``x`` is not an instance of ``MyExtensionType``.
This tests for the exact class for builtin types,
but allows subclasses for :ref:`extension-types`.
Statements and expressions
==========================
...
...
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