Commit 4a99c52c authored by scoder's avatar scoder Committed by GitHub

Merge pull request #2259 from gabrieldemarmiesse/transfer_checked_type_casts

transfered checked type casts
parents b701fdb7 d08a9ad0
......@@ -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
==========================
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment