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

Skip to content

Commit a5f9158

Browse files
committed
MNT: add support for 3.14.0b1
1 parent 96e5d55 commit a5f9158

2 files changed

Lines changed: 8 additions & 34 deletions

File tree

numpy/_core/src/multiarray/temp_elide.c

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,6 @@
6262

6363
#include <feature_detection_misc.h>
6464

65-
#if PY_VERSION_HEX >= 0x030E00A7 && !defined(PYPY_VERSION)
66-
#define Py_BUILD_CORE
67-
#include "internal/pycore_frame.h"
68-
#include "internal/pycore_interpframe.h"
69-
#undef Py_BUILD_CORE
70-
#endif
71-
7265
/* 1 prints elided operations, 2 prints stacktraces */
7366
#define NPY_ELIDE_DEBUG 0
7467
#define NPY_MAX_STACKSIZE 10
@@ -119,33 +112,11 @@ find_addr(void * addresses[], npy_intp naddr, void * addr)
119112
static int
120113
check_unique_temporary(PyObject *lhs)
121114
{
122-
#if PY_VERSION_HEX >= 0x030E00A7 && !defined(PYPY_VERSION)
123-
// In Python 3.14.0a7 and later, a reference count of one doesn't guarantee
124-
// that an object is a unique temporary variable. We scan the top of the
125-
// interpreter stack to check if the object exists as an "owned" reference
126-
// in the temporary stack.
127-
PyFrameObject *frame = PyEval_GetFrame();
128-
if (frame == NULL) {
129-
return 0;
130-
}
131-
_PyInterpreterFrame *f = frame->f_frame;
132-
_PyStackRef *base = _PyFrame_Stackbase(f);
133-
_PyStackRef *stackpointer = f->stackpointer;
134-
int found_once = 0;
135-
while (stackpointer > base) {
136-
stackpointer--;
137-
PyObject *obj = PyStackRef_AsPyObjectBorrow(*stackpointer);
138-
if (obj == lhs) {
139-
if (!found_once && PyStackRef_IsHeapSafe(*stackpointer)) {
140-
found_once = 1;
141-
}
142-
else {
143-
return 0;
144-
}
145-
}
146-
return found_once;
147-
}
148-
return 0;
115+
#if PY_VERSION_HEX == 0x030E00A7 && !defined(PYPY_VERSION)
116+
#error "NumPy is broken on CPython 3.14.0a7, please update to a newer version"
117+
#elif PY_VERSION_HEX >= 0x030E00B1 && !defined(PYPY_VERSION)
118+
// see https://github.com/python/cpython/issues/133164
119+
return PyUnstable_Object_IsUniqueReferencedTemporary(lhs);
149120
#else
150121
return 1;
151122
#endif

pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ filterwarnings =
2727
ignore:\n\n `numpy.distutils`:DeprecationWarning
2828
# Ignore DeprecationWarning from typing.mypy_plugin
2929
ignore:`numpy.typing.mypy_plugin` is deprecated:DeprecationWarning
30+
# Ignore DeprecationWarning from struct module
31+
# see https://github.com/numpy/numpy/issues/28926
32+
ignore:Due to \'_pack_\', the

0 commit comments

Comments
 (0)