8000 MNT: use pythoncapi_compat.h in npy_compat.h by ngoldbaum · Pull Request #26189 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

MNT: use pythoncapi_compat.h in npy_compat.h #26189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@
[submodule "numpy/fft/pocketfft"]
path = numpy/fft/pocketfft
url = https://github.com/mreineck/pocketfft
[submodule "numpy/_core/src/common/pythoncapi-compat"]
path = numpy/_core/src/common/pythoncapi-compat
url = https://github.com/python/pythoncapi-compat
5 changes: 5 additions & 0 deletions numpy/_core/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ if use_intel_sort and not fs.exists('src/npysort/x86-simd-sort/README.md')
error('Missing the `x86-simd-sort` git submodule! Run `git submodule update --init` to fix this.')
endif

if not fs.exists('src/common/pythoncapi-compat')
error('Missing the `pythoncapi-compat` git submodule! ' +
'Run `git submodule update --init` to fix this.')
endif

# Check sizes of types. Note, some of these landed in config.h before, but were
# unused. So clean that up and only define the NPY_SIZEOF flavors rather than
# the SIZEOF ones
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/common/array_assign.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include <numpy/ndarraytypes.h>
#include "npy_config.h"
#include "npy_pycompat.h"


#include "shape.h"

Expand Down
5 changes: 3 additions & 2 deletions numpy/_core/src/common/npy_argparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
#include <Python.h>

#include "numpy/ndarraytypes.h"
#include "numpy/npy_2_compat.h"
#include "npy_argparse.h"
#include "npy_pycompat.h"

#include "npy_import.h"

#include "arrayfunction_override.h"
Expand Down Expand Up @@ -195,7 +196,7 @@ initialize_keywords(const char *funcname,
}
if (i >= npositional_only) {
int i_kwarg = i - npositional_only;
cache->kw_strings[i_kwarg] = PyUString_InternFromString(name);
cache->kw_strings[i_kwarg] = PyUnicode_InternFromString(name);
if (cache->kw_strings[i_kwarg] == NULL) {
va_end(va);
goto error;
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/common/npy_longdouble.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "numpy/ndarraytypes.h"
#include "numpy/npy_math.h"
#include "npy_pycompat.h"

#include "numpyos.h"

/*
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/common/npy_pycompat.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define NUMPY_CORE_SRC_COMMON_NPY_PYCOMPAT_H_

#include "numpy/npy_3kcompat.h"

#include "pythoncapi-compat/pythoncapi_compat.h"

/*
* In Python 3.10a7 (or b1), python started using the identity for the hash
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/common/numpyos.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "npy_config.h"

#include "npy_pycompat.h"


#if defined(HAVE_STRTOLD_L) && !defined(_GNU_SOURCE)
# define _GNU_SOURCE
Expand Down
1 change: 1 addition & 0 deletions numpy/_core/src/common/pythoncapi-compat
Submodule pythoncapi-compat added at f66799
2 changes: 1 addition & 1 deletion numpy/_core/src/common/ucsnarrow.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "npy_config.h"

#include "npy_pycompat.h"

#include "ctors.h"

/*
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/common/ufunc_override.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE

#include "npy_pycompat.h"
#include "numpy/ndarraytypes.h"
#include "get_attr_string.h"
#include "npy_import.h"
#include "ufunc_override.h"
Expand Down
2 changes: 0 additions & 2 deletions numpy/_core/src/dummymodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
#define PY_SSIZE_T_CLEAN
#include <Python.h>

#include "npy_pycompat.h"

static struct PyMethodDef methods[] = {
{NULL, NULL, 0, NULL}
};
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/_multiarray_tests.c.src
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ IsPythonScalar(PyObject * dummy, PyObject *args)
}
}

#include "npy_pycompat.h"



/** Function to test calling via ctypes */
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/array_assign_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "numpy/npy_math.h"

#include "npy_config.h"
#include "npy_pycompat.h"


#include "convert_datatype.h"
#include "methods.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/array_assign_scalar.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "numpy/npy_math.h"

#include "npy_config.h"
#include "npy_pycompat.h"


#include "convert_datatype.h"
#include "methods.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/array_converter.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include "npy_config.h"

#include "npy_pycompat.h"

#include "array_assign.h"

#include "common.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/arrayfunction_override.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <Python.h>
#include "structmember.h"

#include "npy_pycompat.h"
#include "numpy/ndarraytypes.h"
#include "get_attr_string.h"
#include "npy_import.h"
#include "multiarraymodule.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/calculation.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "npy_config.h"

#include "npy_pycompat.h"


#include "common.h"
#include "number.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "numpy/arrayobject.h"

#include "npy_config.h"
#include "npy_pycompat.h"

#include "common.h"

#include "abstractdtypes.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/conversion_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "numpy/npy_math.h"

#include "npy_config.h"
#include "npy_pycompat.h"


#include "common.h"
#include "arraytypes.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "numpy/arrayobject.h"
#include "numpy/arrayscalars.h"
#include "npy_pycompat.h"


#include "common.h"
#include "arrayobject.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/ctors.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "npy_config.h"

#include "npy_ctypes.h"
#include "npy_pycompat.h"

#include "multiarraymodule.h"

#include "common.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/datetime.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "numpyos.h"

#include "npy_config.h"
#include "npy_pycompat.h"


#include "common.h"
#include "numpy/arrayscalars.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/datetime_busday.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <numpy/arrayobject.h>

#include "npy_config.h"
#include "npy_pycompat.h"


#include "numpy/arrayscalars.h"
#include "lowlevel_strided_loops.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/datetime_busdaycal.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "numpy/arrayscalars.h"

#include "npy_config.h"
#include "npy_pycompat.h"


#include "common.h"
#include "lowlevel_strided_loops.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/datetime_strings.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "numpy/arrayobject.h"

#include "npy_config.h"
#include "npy_pycompat.h"


#include "numpy/arrayscalars.h"
#include "convert_datatype.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/descriptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "npy_config.h"
#include "npy_ctypes.h"
#include "npy_import.h"
#include "npy_pycompat.h"


#include "_datetime.h"
#include "common.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/dragon4.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#define _MULTIARRAYMODULE
#include "numpy/arrayobject.h"
#include "npy_config.h"
#include "npy_pycompat.h"

#include "numpy/arrayscalars.h"

/* Half binary format */
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/dtype_transfer.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "numpy/npy_math.h"

#include "lowlevel_strided_loops.h"
#include "npy_pycompat.h"


#include "convert_datatype.h"
#include "ctors.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/dtypemeta.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <numpy/ndarraytypes.h>
#include <numpy/arrayscalars.h>
#include <numpy/npy_math.h>
#include "npy_pycompat.h"

#include "npy_import.h"

#include "abstractdtypes.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/einsum.c.src
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#define _MULTIARRAYMODULE
#include <numpy/npy_common.h>
#include <numpy/arrayobject.h>
#include <npy_pycompat.h>

#include <array_assign.h> //PyArray_AssignRawScalar

#include <ctype.h>
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/flagsobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include "npy_config.h"

#include "npy_pycompat.h"

#include "array_assign.h"

#include "common.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/getset.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "numpy/arrayobject.h"

#include "npy_config.h"
#include "npy_pycompat.h"

#include "npy_import.h"

#include "common.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/hashdescr.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "npy_config.h"

#include "npy_pycompat.h"


#include "hashdescr.h"

Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/item_selection.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include "npy_config.h"

#include "npy_pycompat.h"


#include "multiarraymodule.h"
#include "common.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/iterators.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "npy_config.h"

#include "npy_pycompat.h"


#include "arrayobject.h"
#include "iterators.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/nditer_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <structmember.h>

#include "numpy/arrayobject.h"
#include "npy_pycompat.h"

#include "convert_datatype.h"

#include "lowlevel_strided_loops.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/nditer_pywrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "numpy/arrayobject.h"
#include "npy_config.h"
#include "npy_pycompat.h"

#include "alloc.h"
#include "common.h"
#include "conversion_utils.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/number.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "numpy/arrayobject.h"

#include "npy_config.h"
#include "npy_pycompat.h"

#include "npy_import.h"
#include "common.h"
#include "number.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/refcount.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "npy_config.h"

#include "npy_pycompat.h"


/*
* Helper function to clear a strided memory (normally or always contiguous)
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/scalarapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include "npy_config.h"

#include "npy_pycompat.h"


#include "array_coercion.h"
#include "ctors.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/sequence.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "npy_config.h"

#include "npy_pycompat.h"


#include "common.h"
#include "mapping.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/shape.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include "npy_config.h"

#include "npy_pycompat.h"


#include "arraywrap.h"
#include "ctors.h"
Expand Down
2 changes: 1 addition & 1 deletion numpy/_core/src/multiarray/usertypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ maintainer email: oliphant.travis@ieee.org

#include "common.h"

#include "npy_pycompat.h"


#include "usertypes.h"
#include "dtypemeta.h"
Expand Down
Loading
0