Skip to content

Commit ff00462

Browse files
committed
BLD: add support for building against Python's Limited API
1 parent e172d5a commit ff00462

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

bottleneck/src/bottleneck.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
#include <numpy/arrayobject.h>
88
#include <bn_config.h>
99

10+
#ifdef Py_LIMITED_API
11+
#define PyTuple_GET_ITEM PyTuple_GetItem
12+
#define PyTuple_GET_SIZE PyTuple_Size
13+
#endif
14+
1015
/* THREADS=1 releases the GIL but increases function call
1116
* overhead. THREADS=0 does not release the GIL but keeps
1217
* function call overhead low. Curly brackets are for C89

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ skip = [
9999
"*_i686",
100100
"cp310-win_arm64", # no numpy wheels for this target
101101
]
102+
environment = { "BN_LIMITED_API" = "1" }
102103

103104
[tool.ruff]
104105
exclude = [

0 commit comments

Comments
 (0)