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

Skip to content

Commit ffcee41

Browse files
authored
Merge pull request #24413 from mattip/v3.12.0rc1
BUG: cleanup warnings [skip azp][skip circle][skip travis][skip cirrus]
2 parents 104addf + 6e2b2f6 commit ffcee41

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

numpy/_build_utils/gitversion.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
def init_version():
66
init = os.path.join(os.path.dirname(__file__), '../../pyproject.toml')
7-
data = open(init).readlines()
7+
with open(init) as fid:
8+
data = fid.readlines()
89

910
version_line = next(
1011
line for line in data if line.startswith('version =')

numpy/core/src/multiarray/compiled_base.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,7 +1412,18 @@ arr_add_docstring(PyObject *NPY_UNUSED(dummy), PyObject *const *args, Py_ssize_t
14121412
static char *msg = "already has a different docstring";
14131413

14141414
/* Don't add docstrings */
1415+
#if PY_VERSION_HEX > 0x030b0000
1416+
static long optimize = -1000;
1417+
if (optimize < 0) {
1418+
PyObject *flags = PySys_GetObject("flags"); /* borrowed object */
1419+
PyObject *level = PyObject_GetAttrString(flags, "optimize");
1420+
optimize = PyLong_AsLong(level);
1421+
Py_DECREF(level);
1422+
}
1423+
if (optimize > 1) {
1424+
#else
14151425
if (Py_OptimizeFlag > 1) {
1426+
#endif
14161427
Py_RETURN_NONE;
14171428
}
14181429

0 commit comments

Comments
 (0)