Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,6 @@ jobs:
matrix_yaml: |
include:
# x86_64 windows
- { spec: cp39-win_amd64, omit: ${{ env.skip_ci_redundant_jobs }} }
- { spec: cp310-win_amd64, omit: ${{ env.skip_ci_redundant_jobs }} }
- { spec: cp311-win_amd64, omit: ${{ env.skip_ci_redundant_jobs }} }
- { spec: cp312-win_amd64, omit: ${{ env.skip_ci_redundant_jobs }} }
Expand All @@ -323,7 +322,6 @@ jobs:
- { spec: cp315t-win_amd64 }

# x86 windows
- { spec: cp39-win32, omit: ${{ env.skip_ci_redundant_jobs }} }
- { spec: cp310-win32, omit: ${{ env.skip_ci_redundant_jobs }} }
- { spec: cp311-win32, omit: ${{ env.skip_ci_redundant_jobs }} }
- { spec: cp312-win32, omit: ${{ env.skip_ci_redundant_jobs }} }
Expand Down
4 changes: 2 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
# built documents.
#
# The short X.Y version.
version = '2.0'
version = '2.1'
# The full version, including alpha/beta/rc tags.
release = '2.0.1.dev0'
release = '2.1.0.dev0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
4 changes: 2 additions & 2 deletions doc/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ platform as well as on Windows 32 and 64. (It relies occasionally on
libffi, so it depends on libffi being bug-free; this may not be fully
the case on some of the more exotic platforms.)

CFFI is tested with CPython 3.8-3.12.
CFFI is tested with CPython 3.10-3.15.

The core speed of CFFI is better than ctypes, with import times being
either lower if you use the post-1.0 features, or much higher if you
Expand All @@ -29,7 +29,7 @@ libraries on PyPy.

Requirements:

* CPython 3.8+, or PyPy (PyPy 2.0 for the earliest
* CPython 3.10+, or PyPy (PyPy 2.0 for the earliest
versions of CFFI; or PyPy 2.6 for CFFI 1.0).

* in some cases you need to be able to compile C extension modules.
Expand Down
33 changes: 25 additions & 8 deletions doc/source/whatsnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,37 @@
What's New
======================

v2.0.0.dev0
============
v2.1.0.dev0
===========

* Added the ``cffi-gen-src`` command-line tool (also invocable as
``python -m cffi.gen_src``), which generates CFFI C extension
source code, so that a build backend such as `meson-python`_ can build
the extension. See :doc:`cffi-gen-src` for details. Integrated from the
`cffi-buildtool`_ project by Rose Davidson. (`#241`_)
* Added support for arm64 iOS wheels. (`#181`_)
* Dropped support for Python 3.9.
* Added support for Python 3.15 and support for C extensions generated by CFFI
to target the new ``abi3t`` free-threaded ABI. (`#232`_)
* Avoid crashes inside of ``__delitem__``. (`#235`_)
* Avoid "string too big" error under MSVC. (`#167`_)
* Fix mingw builds. (`#198`_)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to mention the new build tool to support non-setuptools build systems?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, of course that's a pretty big new feature!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was already a release note but it was in the 2.0 notes. I moved it into the correct section.


.. _`#167`: https://github.com/python-cffi/cffi/pull/167
.. _`#181`: https://github.com/python-cffi/cffi/pull/181
.. _`#198`: https://github.com/python-cffi/cffi/pull/198
.. _`#232`: https://github.com/python-cffi/cffi/pull/232
.. _`#235`: https://github.com/python-cffi/cffi/pull/235
.. _`#241`: https://github.com/python-cffi/cffi/pull/241

v2.0.0
======

* Added support for free threaded Python. (`#178`_)
Note that the free-threaded build does not yet support building extensions
with the limited API, so you must set py_limited_api=False when building
extensions for the free-threaded build.
* Added support for Python 3.14. (`#177`_)
* Added the ``cffi-gen-src`` command-line tool (also invocable as
``python -m cffi.gen_src``), which generates CFFI C extension
source code, so that a build backend such as `meson-python`_ can build
the extension. See :doc:`cffi-gen-src` for details. Integrated from the
`cffi-buildtool`_ project by Rose Davidson.
* WIP

.. _`meson-python`: https://meson-python.readthedocs.io/
.. _`cffi-buildtool`: https://github.com/inklesspen/cffi-buildtool
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ build-backend = "setuptools.build_meta"

[project]
name = "cffi"
version = "2.0.1.dev0"
version = "2.1.0.dev0"
dependencies = [
"pycparser; implementation_name != 'PyPy'",
]
requires-python = ">=3.9"
requires-python = ">=3.10"

description = "Foreign Function Interface for Python calling C code."
readme = "README.md"
Expand All @@ -20,7 +20,6 @@ license-files = ["LICENSE"]
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand Down
2 changes: 1 addition & 1 deletion src/c/_cffi_backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <Python.h>
#include "structmember.h"
#include "misc_thread_common.h"
#define CFFI_VERSION "2.0.1.dev0"
#define CFFI_VERSION "2.1.0.dev0"

#ifdef MS_WIN32
#include <windows.h>
Expand Down
2 changes: 1 addition & 1 deletion src/c/test_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def _capture_unraisable_hook(ur_args):
# ____________________________________________________________

import sys
assert __version__ == "2.0.1.dev0", ("This test_c.py file is for testing a version"
assert __version__ == "2.1.0.dev0", ("This test_c.py file is for testing a version"
" of cffi that differs from the one that we"
" get from 'import _cffi_backend'")
if sys.version_info < (3,):
Expand Down
4 changes: 2 additions & 2 deletions src/cffi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from .error import CDefError, FFIError, VerificationError, VerificationMissing
from .error import PkgConfigError

__version__ = "2.0.1.dev0"
__version_info__ = (2, 0, 1, 'dev0')
__version__ = "2.1.0.dev0"
__version_info__ = (2, 1, 0, 'dev0')

# The verifier module file names are based on the CRC32 of a string that
# contains the following version number. It may be older than __version__
Expand Down
2 changes: 1 addition & 1 deletion src/cffi/_embedding.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ static int _cffi_initialize_python(void)

if (f != NULL && f != Py_None) {
PyFile_WriteString("\nFrom: " _CFFI_MODULE_NAME
"\ncompiled with cffi version: 2.0.1.dev0"
"\ncompiled with cffi version: 2.1.0.dev0"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a test that this matches the __version_info__?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And could this use CFFI_VERSION instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can't easily use CFFI_VERSION without adding a new header, since that define lives at the top of src/c/_cffi_backend.c.

There is a test for this:

$ pytest testing/cffi0/test_version.py
============================================= test session starts =============================================
platform darwin -- Python 3.15.0b3, pytest-9.1.1, pluggy-1.6.0
rootdir: /Users/goldbaum/Documents/cffi
configfile: pyproject.toml
collected 5 items

testing/cffi0/test_version.py ....F                                                                     [100%]

================================================== FAILURES ===================================================
______________________________________________ test_embedding_h _______________________________________________

    def test_embedding_h():
        cffi_root = Path(os.path.dirname(__file__)).parent.parent
        v = cffi.__version__
        p = cffi_root / 'src/cffi/_embedding.h'
        content = _read(p)
>       assert ('cffi version: %s"' % (v,)) in content
E       assert ('cffi version: %s"' % ('2.1.0.dev0',)) in '\n/***** Support code for embedding *****/\n\n#ifdef __cplusplus\nextern "C" {\n#endif\n\n\n#if defined(_WIN32)\n#  d...\n#undef cffi_compare_and_swap\n#undef cffi_write_barrier\n#undef cffi_read_barrier\n\n#ifdef __cplusplus\n}\n#endif\n'

testing/cffi0/test_version.py:62: AssertionError

I went ahead and updated the test to make that error message nicer for the next person who needs to do this. See the second-to-last commit.

"\n_cffi_backend module: ", f);
modules = PyImport_GetModuleDict();
mod = PyDict_GetItemString(modules, "_cffi_backend");
Expand Down
6 changes: 5 additions & 1 deletion testing/cffi0/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,8 @@ def test_embedding_h():
v = cffi.__version__
p = cffi_root / 'src/cffi/_embedding.h'
content = _read(p)
assert ('cffi version: %s"' % (v,)) in content
loc = content.find('cffi version: ')
assert loc > 0, "Cannot find cffi version string in _embedding.h"
context = content[loc-100:loc+100]
msg = f"CFFI verison is incorrect, context for current version string is:\n{context}"
assert (f'cffi version: {v}"') in context, msg
2 changes: 1 addition & 1 deletion testing/cffi1/cffi_gen_src_examples/common/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ requires = ['meson-python', 'cffi']
name = 'squared'
version = '0.1.0'
description = 'Small self-contained example project that builds a CFFI extension via meson-python.'
requires-python = '>=3.9'
requires-python = '>=3.10'
dependencies = ['cffi']
Loading