| single |
The Cython language makes writing C extensions for the Python language as
easy as Python itself. Cython is a source code translator based on Pyrex_,
but supports more cutting edge functionality and optimizations.
The Cython language is a superset of the Python language (almost all Python
code is also valid Cython code), but Cython additionally supports optional
static typing to natively call C functions, operate with C++ classes and
declare fast C types on variables and class attributes. This allows the
compiler to generate very efficient C code from Cython code.
This makes Cython the ideal language for writing glue code for external
C/C++ libraries, and for fast C modules that speed up the execution of
Python code.
The newest Cython release can always be downloaded from
https://cython.org/.
Unpack the tarball or zip file, enter the directory, and then run::
pip install .
Note that for one-time builds, e.g. for CI/testing, on platforms that are
not
covered by one of the wheel packages provided on PyPI *and* the pure Python
wheel
that we provide is not used, it is substantially faster than a full source
build
to install an uncompiled (slower) version of Cython with::
NO_CYTHON_COMPILE=true pip install .
.. _Pyrex: https://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/
3.2.2 (2025-11-30)
==================
Features added
--------------
* The C-API declarations were updated to include the new ``PyDict_*Ref()``
functions.
(Github issue https://github.com/cython/cython/issues/7291)
Bugs fixed
----------
* Iteration over literal sequences and strings in generators generated
invalid C code since 3.2.0.
This was a regression due to the C array iteration optimisation in
https://github.com/cython/cython/issues/6926, which is now
disabled inside of generators.
(Github issue https://github.com/cython/cython/issues/7342)
* Calling special methods of known exception types failed with an
AttributeError.
(Github issue https://github.com/cython/cython/issues/7342)
* Calling the unbound __mul__ special method of builtin collections with
subtypes failed.
(Github issue https://github.com/cython/cython/issues/7340)
* C string literals could generate invalid "const to non-const" casts in
the C code.
(Github issue https://github.com/cython/cython/issues/7346)
* yield is no longer allowed inside of a ``cython.critical_section``,
but *is* now allowed while holding a ``cython.pymutex``.
(Github issue https://github.com/cython/cython/issues/7317)
* Under lock congestion, acquiring the GIL could crash in Python 3.11, part
2.
This bug was introduced in Cython 3.2.0.
(Github issue https://github.com/cython/cython/issues/7312)
* The new ``py_safe_* functions in libc.threads`` triggered C compiler
warnings.
(Github issue https://github.com/cython/cython/issues/7356)
|