Skip to content

Commit

Permalink
Merge branch 'master' into fix_cpp_locals_test_setup
Browse files Browse the repository at this point in the history
  • Loading branch information
da-woods authored Oct 19, 2024
2 parents 41d5156 + fb60ac9 commit 3b0231d
Show file tree
Hide file tree
Showing 62 changed files with 1,358 additions and 428 deletions.
89 changes: 45 additions & 44 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
#
# FIXME: 'cpp' tests seems to fail due to compilation errors (numpy_pythran_unit)
# in all python versions and test failures (builtin_float) in 3.5<
os: [ubuntu-20.04, windows-2019, macos-12]
os: [ubuntu-22.04, windows-2019, macos-13]
backend: [c, cpp]
python-version:
- "3.7"
Expand All @@ -50,135 +50,136 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13-dev"
- "3.13"
env: [{}]

include:
#- python-version: "3.13-dev"
#- python-version: "3.13"
# allowed_failure: true

# Ubuntu sub-jobs:
# ================
# graalpy is really slow, so put it first...
- os: ubuntu-20.04
# graalpy is really slow...
- os: ubuntu-22.04
python-version: graalpy24
backend: c
env: { NO_CYTHON_COMPILE: 1 }
# GCC 11 (with broad language standards)
- os: ubuntu-20.04
allowed_failure: true
# GCC 13 (with broad language standards)
- os: ubuntu-22.04
python-version: "3.9"
backend: c
env: { GCC_VERSION: 11, EXTRA_CFLAGS: "-std=c99" }
env: { GCC_VERSION: 13, EXTRA_CFLAGS: "-std=c99" }
extra_hash: "-c99"
- os: ubuntu-20.04
- os: ubuntu-22.04
python-version: "3.10"
backend: c
env: { GCC_VERSION: 11, EXTRA_CFLAGS: "-std=c17" }
env: { GCC_VERSION: 13, EXTRA_CFLAGS: "-std=c17" }
extra_hash: "-gcc11"
- os: ubuntu-20.04
- os: ubuntu-22.04
python-version: "3.12"
backend: c
env: { GCC_VERSION: 11, EXTRA_CFLAGS: "-std=c17" }
env: { GCC_VERSION: 13, EXTRA_CFLAGS: "-std=c17" }
extra_hash: "-gcc11"
- os: ubuntu-20.04
python-version: "3.12"
- os: ubuntu-22.04
python-version: "3.13"
backend: cpp
env: { GCC_VERSION: 11, EXTRA_CFLAGS: "-std=c++20" }
env: { GCC_VERSION: 13, EXTRA_CFLAGS: "-std=c++20" }
extra_hash: "-gcc11"
# compile all modules
- os: ubuntu-20.04
- os: ubuntu-22.04
python-version: "3.7"
backend: c
env: { CYTHON_COMPILE_ALL: 1 }
extra_hash: "-all"
- os: ubuntu-20.04
- os: ubuntu-22.04
python-version: "3.7"
backend: cpp
env: { CYTHON_COMPILE_ALL: 1 }
extra_hash: "-all"
- os: ubuntu-20.04
- os: ubuntu-22.04
python-version: "3.11"
backend: c
env: { CYTHON_COMPILE_ALL: 1 }
extra_hash: "-all"
- os: ubuntu-20.04
- os: ubuntu-22.04
python-version: "3.11"
backend: cpp
env: { CYTHON_COMPILE_ALL: 1 }
extra_hash: "-all"
# Linting
- os: ubuntu-20.04
- os: ubuntu-22.04
python-version: "3.9"
backend: "c,cpp"
env: { TEST_CODE_STYLE: 1, NO_CYTHON_COMPILE: 1 }
extra_hash: "-codestyle"
# Limited API
- os: ubuntu-20.04
- os: ubuntu-22.04
python-version: "3.7"
backend: "c,cpp"
env: { LIMITED_API: "--limited-api", NO_LIMITED_COMPILE: 1, EXCLUDE: "--no-file" }
extra_hash: "-limited_api"
- os: ubuntu-20.04
- os: ubuntu-22.04
python-version: "3.8"
backend: "c,cpp"
env: { LIMITED_API: "--limited-api", NO_LIMITED_COMPILE: 1, EXCLUDE: "--no-file" }
extra_hash: "-limited_api"
- os: ubuntu-20.04
- os: ubuntu-22.04
python-version: "3.11"
backend: "c,cpp"
env: { LIMITED_API: "--limited-api", EXCLUDE: "--no-file" }
extra_hash: "-limited_api"
- os: ubuntu-20.04
- os: ubuntu-22.04
python-version: "3.12"
allowed_failure: true
backend: "c,cpp"
env: { LIMITED_API: "--limited-api", EXCLUDE: "--no-file" }
extra_hash: "-limited_api"
- os: ubuntu-20.04
python-version: "3.13-dev"
- os: ubuntu-22.04
python-version: "3.13"
allowed_failure: true
backend: "c,cpp"
env: { LIMITED_API: "--limited-api", EXCLUDE: "--no-file" }
extra_hash: "-limited_api"
# Type specs
- os: ubuntu-20.04
- os: ubuntu-22.04
python-version: "3.12"
backend: c
env: { EXTRA_CFLAGS: "-DCYTHON_USE_TYPE_SPECS=1" }
extra_hash: "-typespecs"
- os: ubuntu-20.04
- os: ubuntu-22.04
python-version: "3.9"
backend: c
env: { EXTRA_CFLAGS: "-DCYTHON_USE_TYPE_SPECS=1" }
extra_hash: "-typespecs"
- os: ubuntu-20.04
- os: ubuntu-22.04
python-version: "3.8"
backend: c
env: { EXTRA_CFLAGS: "-DCYTHON_USE_TYPE_SPECS=1" }
extra_hash: "-typespecs"
- os: ubuntu-20.04
- os: ubuntu-22.04
python-version: "3.7"
backend: c
env: { EXTRA_CFLAGS: "-DCYTHON_USE_TYPE_SPECS=1" }
extra_hash: "-typespecs"
# Stackless
- os: ubuntu-20.04
- os: ubuntu-22.04
python-version: "3.8"
backend: c
env: { STACKLESS: true, PY: 3 }
extra_hash: "-stackless"
# Pypy
- os: ubuntu-20.04
- os: ubuntu-22.04
python-version: pypy-3.9
backend: c
env: { NO_CYTHON_COMPILE: 1 }
- os: ubuntu-20.04
- os: ubuntu-22.04
python-version: pypy-3.10
backend: c
env: { NO_CYTHON_COMPILE: 1 }
# Free-threading
- os: ubuntu-20.04
python-version: 3.13-freethreading-dev
- os: ubuntu-22.04
python-version: 3.13-freethreading
backend: "c,cpp"
env: {}
allowed_failure: true
Expand All @@ -192,8 +193,8 @@ jobs:
env:
BACKEND: ${{ matrix.backend }}
PYTHON_VERSION: ${{ matrix.python-version }}
MACOSX_DEPLOYMENT_TARGET: 11.0
GCC_VERSION: 8
MACOSX_DEPLOYMENT_TARGET: "11.0"
GCC_VERSION: 10
USE_CCACHE: 1
CCACHE_SLOPPINESS: "pch_defines,time_macros"
CCACHE_COMPRESS: 1
Expand All @@ -207,15 +208,15 @@ jobs:

- name: Setup python
uses: actions/[email protected]
if: "!endsWith(matrix.python-version, '-freethreading-dev')"
if: "!endsWith(matrix.python-version, '-freethreading')"
with:
python-version: ${{ matrix.python-version }}

- name: Setup python from deadsnakes
uses: deadsnakes/[email protected]
if: "endsWith(matrix.python-version, '-freethreading-dev')"
if: "endsWith(matrix.python-version, '-freethreading')"
with:
python-version: 3.13-dev
python-version: "3.13"
nogil: true

- name: Compilation Cache
Expand Down Expand Up @@ -246,11 +247,11 @@ jobs:


pycoverage:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

env:
BACKEND: c,cpp
OS_NAME: ubuntu-20.04
OS_NAME: ubuntu-22.04
PYTHON_VERSION: "3.11"

steps:
Expand All @@ -273,11 +274,11 @@ jobs:
path: coverage-report-html

cycoverage:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

env:
BACKEND: c,cpp
OS_NAME: ubuntu-20.04
OS_NAME: ubuntu-22.04
PYTHON_VERSION: "3.11"

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:

- name: Upload wheels to scientific-python-nightly-wheels
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
uses: scientific-python/upload-nightly-action@b67d7fcc0396e1128a474d1ab2b48aa94680f9fc # 0.5.0
uses: scientific-python/upload-nightly-action@82396a2ed4269ba06c6b2988bb4fd568ef3c3d6b # 0.6.1
with:
artifacts_path: dist
anaconda_nightly_upload_token: ${{ secrets.CYTHON_NIGHTLY_UPLOAD_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
- uses: actions/checkout@v4
- name: Install cibuildwheel
# Nb. keep cibuildwheel version pin consistent with job below
run: pipx install cibuildwheel==2.20.0
run: pipx install cibuildwheel==2.21.3
- id: set-matrix
run: |
MATRIX=$(
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:

- name: Build wheels
# Nb. keep cibuildwheel version pin consistent with generate-matrix job above
uses: pypa/cibuildwheel@v2.20.0
uses: pypa/cibuildwheel@v2.21.3
with:
only: ${{ matrix.only }}
# TODO: Cython tests take a long time to complete
Expand Down
13 changes: 13 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ Features added
* Several issues with the gdb support were resolved.
Patches by Kent Slaney. (Github issues :issue:`5955`, :issue:`5948`)

* ``typing.Union[SomeType, None]`` and ``SomeType | None`` are now understood and mean
the same as ``typing.Optional[SomeType]``, allowing ``None`` in type checks.
(Github issue :issue:`6254`)

* ``cython.const[]`` and ``cython.volatile[]`` are now available as type modifiers in Python code.
(Github issue :issue:`5728`)

* ``cython.pointer[SomeCType]`` can now be used to define pointer types in Python type annotations.
(Github issue :issue:`5071`)

* Several improvements were made to reduce the size of the resulting extension modules.
(Github issue :issue:`4425`)

Expand Down Expand Up @@ -113,6 +123,9 @@ Bugs fixed
* The ``__class__`` cell variable in methods was not always working as in Python.
Initial patch by Tom Keefe. (Github issue :issue:`2912`)

* Lambda functions had no code objects. Their signature can now be introspected.
(Github issue :issue:`2983`)

* Subtyping `complex` as extension type could fail.
(Github issue :issue:`6346`)

Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See [docs/CONTRIBUTING.rst](docs/CONTRIBUTING.rst).
6 changes: 3 additions & 3 deletions Cython/Compiler/Code.py
Original file line number Diff line number Diff line change
Expand Up @@ -2852,8 +2852,6 @@ def put_release_ensured_gil(self, variable=None):
self.putln("__Pyx_PyGILState_Release(%s);" % variable)

def put_acquire_freethreading_lock(self):
self.globalstate.use_utility_code(
UtilityCode.load_cached("AccessPyMutexForFreeThreading", "ModuleSetupCode.c"))
self.putln("#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING")
self.putln(f"PyMutex_Lock(&{Naming.parallel_freethreading_mutex});")
self.putln("#endif")
Expand Down Expand Up @@ -3099,8 +3097,10 @@ def put_trace_return(self, retvalue_cname, pos, return_type=None, nogil=False):
extra_arg = ""
trace_func = "__Pyx_TraceReturnValue"

if return_type is None or return_type.is_pyobject:
if return_type is None:
pass
elif return_type.is_pyobject:
retvalue_cname = return_type.as_pyobject(retvalue_cname)
elif return_type.is_void:
retvalue_cname = 'Py_None'
elif return_type.to_py_function:
Expand Down
Loading

0 comments on commit 3b0231d

Please sign in to comment.