Metadata-Version: 2.4
Name: Cython
Version: 3.3.1
Summary: The Cython compiler for writing C extensions in the Python language.
Home-page: https://cython.org/
Author: Robert Bradshaw, Stefan Behnel, David Woods, Greg Ewing, et al.
Author-email: cython-devel@python.org
License: Apache-2.0
Project-URL: Documentation, https://cython.readthedocs.io/
Project-URL: Donate, https://cython.readthedocs.io/en/latest/src/donating.html
Project-URL: Source Code, https://github.com/cython/cython
Project-URL: Bug Tracker, https://github.com/cython/cython/issues/
Project-URL: User Group, https://groups.google.com/g/cython-users
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Programming Language :: Python :: Implementation :: GraalPy
Classifier: Programming Language :: C
Classifier: Programming Language :: C++
Classifier: Programming Language :: Cython
Classifier: Topic :: Software Development :: Code Generators
Classifier: Topic :: Software Development :: Compilers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/x-rst
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: project-url
Dynamic: requires-python
Dynamic: summary

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 ``<stdbool.h>`` 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)

* Cascaded assignments to differently type-inferred variables could generate incorrect C code.
  (Github issue https://github.com/cython/cython/issues/7937)

* Method calls on typed containers with unused results could generate incorrect C code.
  (Github issue https://github.com/cython/cython/issues/7922)

* Using ``None``-returning builtin methods as part of expressions could generate incorrect C code.
  (Github issue https://github.com/cython/cython/issues/7946)

* The C code generated for exception groups could lack a C variable declaration.
  Patch by bwenstar.  (Github issue https://github.com/cython/cython/issues/8043)

* Exporting fused functions generated invalid C code in API header files.
  Patch by Ardi Loot.  (Github issue https://github.com/cython/cython/issues/7972)

* With ``CYTHON_USE_MODULE_STATE=1``, using a memoryview typed argument with default generated incorrect C code.
  Patch by demrom.  (Github issue https://github.com/cython/cython/issues/7981)

* Non-trivially generated keyword arguments (e.g. ``**{dict}``) could fail to compile.
  (Github issue https://github.com/cython/cython/issues/7921)

* Builtin method calls on dicts from non-trivial expressions could fail to compile.
  (Github issue https://github.com/cython/cython/issues/7931)

* Some builtin optimisations could fail to compile on non-trivial expressions.
  (Github issue https://github.com/cython/cython/issues/7957)

* Typing a global variable with an unknown type could fail to compile.
  (Github issue https://github.com/cython/cython/issues/7970)

* Declaring a C array of extension types crashed Cython after reporting the error.
  Patch by Vladimir Saraikin.  (Github issue https://github.com/cython/cython/issues/1993)

* Optimised string comparison to single-character text strings accidentally allowed bytes.
  (Github issue https://github.com/cython/cython/issues/7924)

* Errors while testing object attributes in match statements were ignored.
  Patch by Vineet Kumar.  (Github issue https://github.com/cython/cython/issues/8029)

* A dangling pointer was fixed when assigning to attributes of extension types.
  (Github issue https://github.com/cython/cython/issues/7907)

* Re-raising an exception from an awaited Python coroutine could leak a frame reference.
  Patch by bwenstar.  (Github issue https://github.com/cython/cython/issues/8042)

* Trying to reimport a module compiled with module state now raises an exception instead of
  returning the original module, which let CPython overwrite the module state and crash.
  Patch by Max Azatian.  (Github issue https://github.com/cython/cython/issues/8048)

* Throwing into a pending async generator's ``aclose()`` could crash.
  Patch by Arthur Villeneuve.  (Github issue https://github.com/cython/cython/issues/8027)

* A crash was resolved when mixing Cython modules compiled with different Limited API versions.
  (Github issue https://github.com/cython/cython/issues/7914)

* A GCC LTO-related compile/link problem was resolved when comparing Python ints.
  (Github issue https://github.com/cython/cython/issues/7908)

* ``isfinite()`` was used for Python float comparisons but not defined in NetBSD in C++ compile mode.
  (Github issue https://github.com/cython/cython/issues/7915)

* The ``__Pyx_pretend_to_initialize()`` function could fail to compile in C code that doesn't even need it.
  (Github issue https://github.com/cython/cython/issues/7941)

* Modules containing only the empty string as single bytes literal generated invalid C code.
  (Github issue https://github.com/cython/cython/issues/7965)

* User cimports of C++ names could break the internally generated C++ conversion functions
  and lead to compile failures or incorrect C++ code.
  (Github issue https://github.com/cython/cython/issues/7939)

* The C code generated for the shared module was not deterministic.
  Patch by Ralf Gommers.  (Github issue https://github.com/cython/cython/issues/7982)

* Special .pxd file names like ``__init__.pxd`` and version file suffixes were mishandled
  when stripping file paths.
  Patch by Ralf Gommers.  (Github issue https://github.com/cython/cython/issues/7984)

* Non-standard type initialisation in SageMath allowed repeated initialisation
  of Cython's internal types, overwriting the previous types and leaking memory.
  Patch by Chenxin Zhong.  (Github issue https://github.com/cython/cython/issues/7976)

* Single-phase module initialisation in freethreading Python didn't allow overriding the
  FT-compatibility flag from a C macro (as supported for multi-phase initialisation).
  (Github issue https://github.com/cython/cython/issues/8036)

* A C compiler warning in MSVC was resolved.
  (Github issue https://github.com/cython/cython/issues/7911)

* A C compiler warning for an unused variable was resolved.
  Patch by WyattBlue.  (Github issue https://github.com/cython/cython/issues/8087)

* PyPy now uses type specs by default.
  Patch by Matti Picus.  (Github issue https://github.com/cython/cython/issues/7947)

* Some older PyPy C-API workarounds were disabled for newer versions.
  Patch by Matti Picus.  (Github issue https://github.com/cython/cython/issues/7974)

* GraalPython now uses the Limited API for Cython functions.
  Patch by Michael Šimáček.  (Github issue https://github.com/cython/cython/issues/7971)

* The C-API of the ``array`` module is supported in GraalPython.
  (Github issue https://github.com/cython/cython/issues/7964)

* Older Android builds no longer use C ``complex`` (which they only partially implemented).
  (Github issue https://github.com/cython/cython/issues/8026)

* Copying the ``Shadow.py`` module into user packages could fail due to internal re-imports.
  Patch by Vincent Fazio.  (Github issue https://github.com/cython/cython/issues/7999)

* Several issues were resolved when using the Cython file cache directory in concurrent processes.
  The cache is also more effective now because it previously deleted the most recent instead of
  the oldest file on cleanup.
  Patches by Lawrence Mitchell and Samuel Hills.
  (Github issues https://github.com/cython/cython/issues/7983, https://github.com/cython/cython/issues/7985, https://github.com/cython/cython/issues/8090)

* The Cython file cache key didn't take the compiler directives into account.
  Patch by Robert Dazi.  (Github issue https://github.com/cython/cython/issues/7532)

* The encoding line detection at the start of source files was too eager to search also non-comments.
  (Github issue https://github.com/cython/cython/issues/7935)

* Enabling annotated HTML file generation together with the shared module could fail to compile.
  (Github issue https://github.com/cython/cython/issues/7910)

Other changes
-------------

* Generating a shared utility module no longer embeds its destination directory
  in the generated C code, making the output reproducible across build directories.
  It is now recommended to pass the ``--module-name`` option to ``cython generate-shared``
  to provide the fully qualified module name explicitly.  This option was ignored
  for the shared module in earlier versions of Cython.
  This is a follow-up fix to the one in 3.3.0, for ``generate-shared /path/to/_{sharedname}.c``.
  Patch by Ralf Gommers.  (Github issue https://github.com/cython/cython/issues/7723)
