Skip to content

Commit e59c074

Browse files
authored
Merge pull request numpy#26189 from ngoldbaum/pythoncapi-compat
MNT: use pythoncapi_compat.h in npy_compat.h
2 parents dc04ad5 + 1bceaf8 commit e59c074

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+66
-53
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@
1616
[submodule "numpy/fft/pocketfft"]
1717
path = numpy/fft/pocketfft
1818
url = https://github.com/mreineck/pocketfft
19+
[submodule "numpy/_core/src/common/pythoncapi-compat"]
20+
path = numpy/_core/src/common/pythoncapi-compat
21+
url = https://github.com/python/pythoncapi-compat

numpy/_core/meson.build

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ if use_intel_sort and not fs.exists('src/npysort/x86-simd-sort/README.md')
123123
error('Missing the `x86-simd-sort` git submodule! Run `git submodule update --init` to fix this.')
124124
endif
125125

126+
if not fs.exists('src/common/pythoncapi-compat')
127+
error('Missing the `pythoncapi-compat` git submodule! ' +
128+
'Run `git submodule update --init` to fix this.')
129+
endif
130+
126131
# Check sizes of types. Note, some of these landed in config.h before, but were
127132
# unused. So clean that up and only define the NPY_SIZEOF flavors rather than
128133
# the SIZEOF ones

numpy/_core/src/common/array_assign.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#include <numpy/ndarraytypes.h>
1717
#include "npy_config.h"
18-
#include "npy_pycompat.h"
18+
1919

2020
#include "shape.h"
2121

numpy/_core/src/common/npy_argparse.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
#include <Python.h>
66

77
#include "numpy/ndarraytypes.h"
8+
#include "numpy/npy_2_compat.h"
89
#include "npy_argparse.h"
9-
#include "npy_pycompat.h"
10+
1011
#include "npy_import.h"
1112

1213
#include "arrayfunction_override.h"
@@ -195,7 +196,7 @@ initialize_keywords(const char *funcname,
195196
}
196197
if (i >= npositional_only) {
197198
int i_kwarg = i - npositional_only;
198-
cache->kw_strings[i_kwarg] = PyUString_InternFromString(name);
199+
cache->kw_strings[i_kwarg] = PyUnicode_InternFromString(name);
199200
if (cache->kw_strings[i_kwarg] == NULL) {
200201
va_end(va);
201202
goto error;

numpy/_core/src/common/npy_longdouble.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include "numpy/ndarraytypes.h"
88
#include "numpy/npy_math.h"
9-
#include "npy_pycompat.h"
9+
1010
#include "numpyos.h"
1111

1212
/*

numpy/_core/src/common/npy_pycompat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define NUMPY_CORE_SRC_COMMON_NPY_PYCOMPAT_H_
33

44
#include "numpy/npy_3kcompat.h"
5-
5+
#include "pythoncapi-compat/pythoncapi_compat.h"
66

77
/*
88
* In Python 3.10a7 (or b1), python started using the identity for the hash

numpy/_core/src/common/numpyos.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include "npy_config.h"
1111

12-
#include "npy_pycompat.h"
12+
1313

1414
#if defined(HAVE_STRTOLD_L) && !defined(_GNU_SOURCE)
1515
# define _GNU_SOURCE
Submodule pythoncapi-compat added at f667991

numpy/_core/src/common/ucsnarrow.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include "npy_config.h"
1111

12-
#include "npy_pycompat.h"
12+
1313
#include "ctors.h"
1414

1515
/*

numpy/_core/src/common/ufunc_override.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
22
#define _MULTIARRAYMODULE
33

4-
#include "npy_pycompat.h"
4+
#include "numpy/ndarraytypes.h"
55
#include "get_attr_string.h"
66
#include "npy_import.h"
77
#include "ufunc_override.h"

0 commit comments

Comments
 (0)