| 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.3.1 (2026-11-01)
==================
Features added
--------------
* Declarations for the C99 bool type in ```` were added.
(Github issue https://github.com/cython/cython/issues/8011)
* Fused function objects are slightly smaller in the Limited API.
(Github issue https://github.com/cython/cython/issues/7967)
* Cython warns when enabling subinterpreter support for modules that cannot
currently support it for technical reasons.
(Github issue https://github.com/cython/cython/issues/8006)
* The shared module is now automatically declared as
freethreading_compatible and sets
subinterpretes_compatible as applicable (currently depending on
memoryview usage).
Both are overridable by users as usual.
(Github issue https://github.com/cython/cython/issues/8037)
Bugs fixed
----------
* Constant folding of multiplied sequences could return incorrect results.
Patch by orztrickster. (Github issue
https://github.com/cython/cython/issues/8021)
* Cython 3.3.0 incorrectly assumed that Python integer powers always return
integers.
Patch by Clay Dugo. (Github issue
https://github.com/cython/cython/issues/7989)
* The return value of optimised calls to ``dict.get()``, ``dict.pop() and
dict.setdefault()``
were inferred independent of their default values, leading to incorrect C
code being generated.
(Github issue https://github.com/cython/cython/issues/7991)
* Some redeclarations of annotated variables were incorrectly rejected.
They are now generally allowed and Cython only warns about obviously
incorrect cases.
(Github issue https://github.com/cython/cython/issues/7920)
* Type inference now respects ``annotation_typing=False`` for local
variable annotations.
Patch by GruffElixir. (Github issue
https://github.com/cython/cython/issues/7994)
* Type inference depended on arbitrary set ordering when circular
references are involved.
As an effect, the ``Cython.Compiler.FlowControl`` module was translated
to slightly
non-deterministic C code.
(Github issue https://github.com/cython/cython/issues/8002)
* Assigning different slices of the same memoryview to different extension
type attributes
could generate incorrect refcounting code.
(Github issue https://github.com/cython/cython/issues/8016)
* Enabling vectorcall for a class with a base class that doesn't have it
incorrectly called
up to the non-existing base class vectorcall slot.
(Github issue https://github.com/cython/cython/issues/7936)
|