Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e87a3c5

Browse files
authored
CI: pin pixi asan build to 3.15.0a6 and re-introduce SetImmortal bindings (#30901)
1 parent fb3b178 commit e87a3c5

4 files changed

Lines changed: 18 additions & 2 deletions

File tree

numpy/_core/src/multiarray/multiarraymodule.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5170,7 +5170,13 @@ _multiarray_umath_exec(PyObject *m) {
51705170
if (PyDataMem_DefaultHandler == NULL) {
51715171
return -1;
51725172
}
5173-
5173+
#ifdef Py_GIL_DISABLED
5174+
if (PyUnstable_SetImmortal(PyDataMem_DefaultHandler) == 0) {
5175+
PyErr_SetString(PyExc_RuntimeError,
5176+
"Could not mark memory handler capsule as immortal");
5177+
return -1;
5178+
}
5179+
#endif
51745180
/*
51755181
* Initialize the context-local current handler
51765182
* with the default PyDataMem_Handler capsule.

numpy/_core/src/umath/extobj.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "numpy/ufuncobject.h"
1616

1717
#include "common.h"
18+
#include "npy_pycompat.h"
1819

1920

2021
#define UFUNC_ERR_IGNORE 0
@@ -145,6 +146,13 @@ init_extobj(void)
145146
if (npy_static_pydata.default_extobj_capsule == NULL) {
146147
return -1;
147148
}
149+
#ifdef Py_GIL_DISABLED
150+
if (PyUnstable_SetImmortal(npy_static_pydata.default_extobj_capsule) == 0) {
151+
PyErr_SetString(PyExc_RuntimeError, "Could not mark extobj capsule as immortal");
152+
Py_CLEAR(npy_static_pydata.default_extobj_capsule);
153+
return -1;
154+
}
155+
#endif
148156
npy_static_pydata.npy_extobj_contextvar = PyContextVar_New(
149157
"numpy.ufunc.extobj", npy_static_pydata.default_extobj_capsule);
150158
if (npy_static_pydata.npy_extobj_contextvar == NULL) {

pixi-packages/asan/pixi.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ extra-args = ["-Csetup-args=-Db_sanitize=address", "-Csetup-args=-Dbuildtype=deb
1919
[package.host-dependencies]
2020
python.git = "https://github.com/python/cpython"
2121
python.subdirectory = "Tools/pixi-packages/asan"
22+
# v3.15.0a6
23+
python.rev = "15b216f30d0445469ec31bc7509fcc55a216ef7c"
2224

2325
meson-python = "*"
2426
cython = "*"

0 commit comments

Comments
 (0)