11diff --git a/numpy/__init__.py b/numpy/__init__.py
2- index ba88c733f..e4db40429 100644
2+ index ba88c73..e4db404 100644
33--- a/numpy/__init__.py
44+++ b/numpy/__init__.py
55@@ -206,7 +206,7 @@ else:
@@ -12,7 +12,7 @@ index ba88c733f..e4db40429 100644
1212 msg = ("The current Numpy installation ({!r}) fails to "
1313 "pass simple sanity checks. This can be caused for example "
1414diff --git a/numpy/core/getlimits.py b/numpy/core/getlimits.py
15- index 544b8b35f..799f669e6 100644
15+ index 544b8b3..799f669 100644
1616--- a/numpy/core/getlimits.py
1717+++ b/numpy/core/getlimits.py
1818@@ -154,87 +154,6 @@ def _register_known_types():
@@ -103,10 +103,47 @@ index 544b8b35f..799f669e6 100644
103103
104104 def _get_machar(ftype):
105105 """ Get MachAr instance or MachAr-like instance
106+ diff --git a/numpy/core/include/numpy/npy_common.h b/numpy/core/include/numpy/npy_common.h
107+ index 64aaaac..4e80fce 100644
108+ --- a/numpy/core/include/numpy/npy_common.h
109+ +++ b/numpy/core/include/numpy/npy_common.h
110+ @@ -1080,4 +1080,10 @@ typedef npy_int64 npy_datetime;
111+
112+ /* End of typedefs for numarray style bit-width names */
113+
114+ + #if !GRAALVM_PYTHON && (PY_VERSION_HEX < 0x03090000)
115+ + #define Py_SET_REFCNT(ob, v) ((_PyObject_CAST(ob)->ob_refcnt = (v)))
116+ + #define Py_SET_TYPE(ob, v) ((_PyObject_CAST(ob)->ob_type) = (v))
117+ + #define Py_SET_SIZE(ob, v) ((_PyVarObject_CAST(ob)->ob_size = (Py_ssize_t) (v)))
118+ + #endif
119+ +
120+ #endif
121+ diff --git a/numpy/core/setup.py b/numpy/core/setup.py
122+ index aad0aae..de1afd0 100644
123+ --- a/numpy/core/setup.py
124+ +++ b/numpy/core/setup.py
125+ @@ -757,7 +757,7 @@ def configuration(parent_package='',top_path=None):
126+ join('src', 'common', 'numpyos.c'),
127+ ]
128+
129+ - blas_info = get_info('blas_opt', 0)
130+ + blas_info = None # get_info('blas_opt', 0)
131+ if blas_info and ('HAVE_CBLAS', None) in blas_info.get('define_macros', []):
132+ extra_info = blas_info
133+ # These files are also in MANIFEST.in so that they are always in
106134diff --git a/numpy/core/setup_common.py b/numpy/core/setup_common.py
107- index f837df112..d3ce70ddd 100644
135+ index f837df1..ef8bc9a 100644
108136--- a/numpy/core/setup_common.py
109137+++ b/numpy/core/setup_common.py
138+ @@ -110,7 +110,7 @@ MANDATORY_FUNCS = ["sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs",
139+ OPTIONAL_STDFUNCS = ["expm1", "log1p", "acosh", "asinh", "atanh",
140+ "rint", "trunc", "exp2", "log2", "hypot", "atan2", "pow",
141+ "copysign", "nextafter", "ftello", "fseeko",
142+ - "strtoll", "strtoull", "cbrt", "strtold_l", "fallocate",
143+ + "strtoll", "strtoull", "cbrt", "fallocate",
144+ "backtrace", "madvise"]
145+
146+
110147@@ -243,8 +243,8 @@ def check_long_double_representation(cmd):
111148 except ValueError:
112149 # try linking to support CC="gcc -flto" or icc -ipo
@@ -118,21 +155,8 @@ index f837df112..d3ce70ddd 100644
118155 src, obj = cmd._compile(body, None, None, 'c')
119156 cmd.temp_files.append("_configtest")
120157 cmd.compiler.link_executable([obj], "_configtest")
121- diff --git a/numpy/core/setup.py b/numpy/core/setup.py
122- index 8b2ded1f2..8a9295a27 100755
123- --- a/numpy/core/setup.py
124- +++ b/numpy/core/setup.py
125- @@ -755,7 +755,7 @@ def configuration(parent_package='',top_path=None):
126- join('src', 'common', 'numpyos.c'),
127- ]
128-
129- - blas_info = get_info('blas_opt', 0)
130- + blas_info = None # get_info('blas_opt', 0)
131- if blas_info and ('HAVE_CBLAS', None) in blas_info.get('define_macros', []):
132- extra_info = blas_info
133- # These files are also in MANIFEST.in so that they are always in
134158diff --git a/numpy/core/src/multiarray/_multiarray_tests.c.src b/numpy/core/src/multiarray/_multiarray_tests.c.src
135- index 9061c0518..bb1dcff0c 100644
159+ index 9061c05..bb1dcff 100644
136160--- a/numpy/core/src/multiarray/_multiarray_tests.c.src
137161+++ b/numpy/core/src/multiarray/_multiarray_tests.c.src
138162@@ -1728,21 +1728,7 @@ get_fpu_mode(PyObject *NPY_UNUSED(self), PyObject *args)
@@ -158,7 +182,7 @@ index 9061c0518..bb1dcff0c 100644
158182
159183 /*
160184diff --git a/numpy/core/src/multiarray/alloc.c b/numpy/core/src/multiarray/alloc.c
161- index 6755095d7..e2fbae64f 100644
185+ index 6755095..e2fbae6 100644
162186--- a/numpy/core/src/multiarray/alloc.c
163187+++ b/numpy/core/src/multiarray/alloc.c
164188@@ -73,14 +73,6 @@ _npy_alloc_cache(npy_uintp nelem, npy_uintp esz, npy_uint msz,
@@ -176,8 +200,34 @@ index 6755095d7..e2fbae64f 100644
176200 #endif
177201 }
178202 return p;
203+ diff --git a/numpy/core/src/multiarray/scalarapi.c b/numpy/core/src/multiarray/scalarapi.c
204+ index bc435d1..b1e1e2f 100644
205+ --- a/numpy/core/src/multiarray/scalarapi.c
206+ +++ b/numpy/core/src/multiarray/scalarapi.c
207+ @@ -789,7 +789,7 @@ PyArray_Scalar(void *data, PyArray_Descr *descr, PyObject *base)
208+ vobj->descr = descr;
209+ Py_INCREF(descr);
210+ vobj->obval = NULL;
211+ - Py_SIZE(vobj) = itemsize;
212+ + Py_SET_SIZE(vobj, itemsize);
213+ vobj->flags = NPY_ARRAY_CARRAY | NPY_ARRAY_F_CONTIGUOUS | NPY_ARRAY_OWNDATA;
214+ swap = 0;
215+ if (PyDataType_HASFIELDS(descr)) {
216+ diff --git a/numpy/core/src/multiarray/scalartypes.c.src b/numpy/core/src/multiarray/scalartypes.c.src
217+ index 52de312..4a8a4c4 100644
218+ --- a/numpy/core/src/multiarray/scalartypes.c.src
219+ +++ b/numpy/core/src/multiarray/scalartypes.c.src
220+ @@ -3067,7 +3067,7 @@ void_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *NPY_UNUSED(kwds))
221+ return PyErr_NoMemory();
222+ }
223+ ((PyVoidScalarObject *)ret)->obval = destptr;
224+ - Py_SIZE((PyVoidScalarObject *)ret) = (int) memu;
225+ + Py_SET_SIZE((PyVoidScalarObject *)ret, (int) memu);
226+ ((PyVoidScalarObject *)ret)->descr =
227+ PyArray_DescrNewFromType(NPY_VOID);
228+ ((PyVoidScalarObject *)ret)->descr->elsize = (int) memu;
179229diff --git a/numpy/core/src/multiarray/typeinfo.c b/numpy/core/src/multiarray/typeinfo.c
180- index 14c4f27cb..c5a72b123 100644
230+ index 14c4f27..c5a72b1 100644
181231--- a/numpy/core/src/multiarray/typeinfo.c
182232+++ b/numpy/core/src/multiarray/typeinfo.c
183233@@ -105,8 +105,7 @@ PyArray_typeinforanged(
@@ -191,7 +241,7 @@ index 14c4f27cb..c5a72b123 100644
191241 static int
192242 PyStructSequence_InitType2(PyTypeObject *type, PyStructSequence_Desc *desc) {
193243diff --git a/numpy/core/src/npymath/ieee754.c.src b/numpy/core/src/npymath/ieee754.c.src
194- index d960838c8..56a8056aa 100644
244+ index d960838..56a8056 100644
195245--- a/numpy/core/src/npymath/ieee754.c.src
196246+++ b/numpy/core/src/npymath/ieee754.c.src
197247@@ -558,12 +558,10 @@ npy_longdouble npy_nextafterl(npy_longdouble x, npy_longdouble y)
@@ -464,8 +514,21 @@ index d960838c8..56a8056aa 100644
464514 }
465515
466516 #endif
517+ diff --git a/numpy/core/src/umath/_rational_tests.c.src b/numpy/core/src/umath/_rational_tests.c.src
518+ index 9e74845..ce21ee4 100644
519+ --- a/numpy/core/src/umath/_rational_tests.c.src
520+ +++ b/numpy/core/src/umath/_rational_tests.c.src
521+ @@ -1193,7 +1193,7 @@ PyMODINIT_FUNC init_rational_tests(void) {
522+ npyrational_arrfuncs.fill = npyrational_fill;
523+ npyrational_arrfuncs.fillwithscalar = npyrational_fillwithscalar;
524+ /* Left undefined: scanfunc, fromstr, sort, argsort */
525+ - Py_TYPE(&npyrational_descr) = &PyArrayDescr_Type;
526+ + Py_SET_TYPE(&npyrational_descr, &PyArrayDescr_Type);
527+ npy_rational = PyArray_RegisterDataType(&npyrational_descr);
528+ if (npy_rational<0) {
529+ goto fail;
467530diff --git a/numpy/core/src/umath/extobj.c b/numpy/core/src/umath/extobj.c
468- index aea1815e8..b83fab9e5 100644
531+ index aea1815..b83fab9 100644
469532--- a/numpy/core/src/umath/extobj.c
470533+++ b/numpy/core/src/umath/extobj.c
471534@@ -282,7 +282,7 @@ _check_ufunc_fperr(int errmask, PyObject *extobj, const char *ufunc_name) {
@@ -478,7 +541,7 @@ index aea1815e8..b83fab9e5 100644
478541 return 0;
479542 }
480543diff --git a/numpy/core/src/umath/loops.c.src b/numpy/core/src/umath/loops.c.src
481- index 975a5e6b8..55f3a4605 100644
544+ index 975a5e6..55f3a46 100644
482545--- a/numpy/core/src/umath/loops.c.src
483546+++ b/numpy/core/src/umath/loops.c.src
484547@@ -1872,7 +1872,7 @@ NPY_NO_EXPORT void
@@ -554,7 +617,7 @@ index 975a5e6b8..55f3a4605 100644
554617 /**end repeat1**/
555618
556619diff --git a/numpy/core/src/umath/reduction.c b/numpy/core/src/umath/reduction.c
557- index 791d3693f..317ee714f 100644
620+ index 791d369..317ee71 100644
558621--- a/numpy/core/src/umath/reduction.c
559622+++ b/numpy/core/src/umath/reduction.c
560623@@ -534,7 +534,7 @@ PyUFunc_ReduceWrapper(PyArrayObject *operand, PyArrayObject *out,
@@ -567,7 +630,7 @@ index 791d3693f..317ee714f 100644
567630 if (NpyIter_GetIterSize(iter) != 0) {
568631 NpyIter_IterNextFunc *iternext;
569632diff --git a/numpy/core/src/umath/scalarmath.c.src b/numpy/core/src/umath/scalarmath.c.src
570- index a7987acda..aae7c30e3 100644
633+ index a7987ac..aae7c30 100644
571634--- a/numpy/core/src/umath/scalarmath.c.src
572635+++ b/numpy/core/src/umath/scalarmath.c.src
573636@@ -846,7 +846,7 @@ static PyObject *
@@ -634,7 +697,7 @@ index a7987acda..aae7c30e3 100644
634697 int bufsize, errmask;
635698 PyObject *errobj;
636699diff --git a/numpy/core/src/umath/simd.inc.src b/numpy/core/src/umath/simd.inc.src
637- index 4bb8569be..8b120d7ff 100644
700+ index 4bb8569..8b120d7 100644
638701--- a/numpy/core/src/umath/simd.inc.src
639702+++ b/numpy/core/src/umath/simd.inc.src
640703@@ -1047,7 +1047,7 @@ sse2_@kind@_@TYPE@(@type@ * ip, @type@ * op, const npy_intp n)
@@ -665,7 +728,7 @@ index 4bb8569be..8b120d7ff 100644
665728 /**end repeat1**/
666729
667730diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c
668- index d1b029c18..2bdff3d6c 100644
731+ index d1b029c..2bdff3d 100644
669732--- a/numpy/core/src/umath/ufunc_object.c
670733+++ b/numpy/core/src/umath/ufunc_object.c
671734@@ -107,7 +107,7 @@ PyUFunc_getfperr(void)
@@ -722,11 +785,24 @@ index d1b029c18..2bdff3d6c 100644
722785
723786 retval = execute_legacy_ufunc_loop(ufunc, trivial_loop_ok,
724787 op, dtypes, order,
788+ diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py
789+ index 14451fa..85e64cc 100644
790+ --- a/numpy/distutils/ccompiler.py
791+ +++ b/numpy/distutils/ccompiler.py
792+ @@ -682,7 +682,7 @@ def CCompiler_cxx_compiler(self):
793+ return self
794+
795+ cxx = copy(self)
796+ - cxx.compiler_so = [cxx.compiler_cxx[0]] + cxx.compiler_so[1:]
797+ + cxx.compiler_so = cxx.compiler_cxx + cxx.compiler_so[1:]
798+ if sys.platform.startswith('aix') and 'ld_so_aix' in cxx.linker_so[0]:
799+ # AIX needs the ld_so_aix script included with Python
800+ cxx.linker_so = [cxx.linker_so[0], cxx.compiler_cxx[0]] \
725801diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py
726- index 9e192329f63..85a0c932145 100644
802+ index 806f4f7..358112d 100644
727803--- a/numpy/distutils/system_info.py
728804+++ b/numpy/distutils/system_info.py
729- @@ -2494 ,8 +2494 ,6 @@ def calc_info(self ):
805+ @@ -1922 ,8 +1922 ,6 @@ class accelerate_info(system_info ):
730806 'accelerate' in libraries):
731807 if intel:
732808 args.extend(['-msse3'])
@@ -735,7 +811,7 @@ index 9e192329f63..85a0c932145 100644
735811 args.extend([
736812 '-I/System/Library/Frameworks/vecLib.framework/Headers'])
737813 link_args.extend(['-Wl,-framework', '-Wl,Accelerate'])
738- @@ -2504 ,8 +2502 ,6 @@ def calc_info(self ):
814+ @@ -1932 ,8 +1930 ,6 @@ class accelerate_info(system_info ):
739815 'veclib' in libraries):
740816 if intel:
741817 args.extend(['-msse3'])
@@ -744,21 +820,34 @@ index 9e192329f63..85a0c932145 100644
744820 args.extend([
745821 '-I/System/Library/Frameworks/vecLib.framework/Headers'])
746822 link_args.extend(['-Wl,-framework', '-Wl,vecLib'])
747- diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py
748- index 14451fa66..85e64cc6e 100644
749- --- a/numpy/distutils/ccompiler.py
750- +++ b/numpy/distutils/ccompiler.py
751- @@ -682,7 +682,7 @@ def CCompiler_cxx_compiler(self):
752- return self
753-
754- cxx = copy(self)
755- - cxx.compiler_so = [cxx.compiler_cxx[0]] + cxx.compiler_so[1:]
756- + cxx.compiler_so = cxx.compiler_cxx + cxx.compiler_so[1:]
757- if sys.platform.startswith('aix') and 'ld_so_aix' in cxx.linker_so[0]:
758- # AIX needs the ld_so_aix script included with Python
759- cxx.linker_so = [cxx.linker_so[0], cxx.compiler_cxx[0]] \
823+ diff --git a/numpy/f2py/rules.py b/numpy/f2py/rules.py
824+ index 23d36b2..264cc2c 100644
825+ --- a/numpy/f2py/rules.py
826+ +++ b/numpy/f2py/rules.py
827+ @@ -208,7 +208,7 @@ PyMODINIT_FUNC init#modulename#(void) {
828+ #else
829+ \tm = #modulename#_module = Py_InitModule(\"#modulename#\", f2py_module_methods);
830+ #endif
831+ - \tPy_TYPE(&PyFortran_Type) = &PyType_Type;
832+ + \tPy_SET_TYPE(&PyFortran_Type, &PyType_Type);
833+ \timport_array();
834+ \tif (PyErr_Occurred())
835+ \t\t{PyErr_SetString(PyExc_ImportError, \"can't initialize module #modulename# (failed to import numpy)\"); return RETVAL;}
836+ diff --git a/numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c b/numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c
837+ index 7f46303..f5bb77a 100644
838+ --- a/numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c
839+ +++ b/numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c
840+ @@ -143,7 +143,7 @@ PyMODINIT_FUNC inittest_array_from_pyobj_ext(void) {
841+ #else
842+ m = wrap_module = Py_InitModule("test_array_from_pyobj_ext", f2py_module_methods);
843+ #endif
844+ - Py_TYPE(&PyFortran_Type) = &PyType_Type;
845+ + Py_SET_TYPE(&PyFortran_Type, &PyType_Type);
846+ import_array();
847+ if (PyErr_Occurred())
848+ Py_FatalError("can't initialize module wrap (failed to import numpy)");
760849diff --git a/numpy/linalg/setup.py b/numpy/linalg/setup.py
761- index 66c07c9e1..847116fdc 100644
850+ index 66c07c9..847116f 100644
762851--- a/numpy/linalg/setup.py
763852+++ b/numpy/linalg/setup.py
764853@@ -29,6 +29,7 @@ def configuration(parent_package='', top_path=None):
@@ -770,7 +859,7 @@ index 66c07c9e1..847116fdc 100644
770859 print("### Warning: Using unoptimized lapack ###")
771860 return all_sources
772861diff --git a/numpy/linalg/umath_linalg.c.src b/numpy/linalg/umath_linalg.c.src
773- index 9fc68a7aa..6c04f96c1 100644
862+ index 9fc68a7..6c04f96 100644
774863--- a/numpy/linalg/umath_linalg.c.src
775864+++ b/numpy/linalg/umath_linalg.c.src
776865@@ -386,7 +386,7 @@ static NPY_INLINE int
@@ -791,37 +880,28 @@ index 9fc68a7aa..6c04f96c1 100644
791880 }
792881 }
793882
794- diff --git a/setup.py b/setup.py
795- index 8b2ded1f2..8a9295a27 100755
796- --- a/setup.py
797- +++ b/setup.py
798- @@ -364,6 +364,8 @@ def setup_package():
799- metadata = dict(
800- name = 'numpy',
801- maintainer = "NumPy Developers",
802- + zip_safe = False, # Truffle: make sure we're not zipped
803- + include_package_data = True,
804- maintainer_email = "numpy-discussion@python.org",
805- description = DOCLINES[0],
806- long_description = "\n".join(DOCLINES[2:]),
807- @@ -376,7 +378,6 @@ def setup_package():
808- test_suite='nose.collector',
809- cmdclass={"sdist": sdist_checked},
810- python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
811- - zip_safe=False,
812- entry_points={
813- 'console_scripts': f2py_cmds
814- },
815- diff --git a/numpy/core/setup_common.py b/numpy/core/setup_common.py
816- index d3ce70d..ef8bc9a 100644
817- --- a/numpy/core/setup_common.py
818- +++ b/numpy/core/setup_common.py
819- @@ -110,7 +110,7 @@ MANDATORY_FUNCS = ["sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs",
820- OPTIONAL_STDFUNCS = ["expm1", "log1p", "acosh", "asinh", "atanh",
821- "rint", "trunc", "exp2", "log2", "hypot", "atan2", "pow",
822- "copysign", "nextafter", "ftello", "fseeko",
823- - "strtoll", "strtoull", "cbrt", "strtold_l", "fallocate",
824- + "strtoll", "strtoull", "cbrt", "fallocate",
825- "backtrace", "madvise"]
826-
827-
883+ diff --git a/numpy/random/mtrand/mtrand.c b/numpy/random/mtrand/mtrand.c
884+ index f9351e1..18c18e5 100644
885+ --- a/numpy/random/mtrand/mtrand.c
886+ +++ b/numpy/random/mtrand/mtrand.c
887+ @@ -1332,7 +1332,7 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
888+ if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
889+ Py_INCREF(x);
890+ PyList_SET_ITEM(list, len, x);
891+ - Py_SIZE(list) = len+1;
892+ + Py_SET_SIZE(list, len+1);
893+ return 0;
894+ }
895+ return PyList_Append(list, x);
896+ @@ -37807,9 +37807,9 @@ static void __pyx_tp_dealloc_6mtrand_RandomState(PyObject *o) {
897+ {
898+ PyObject *etype, *eval, *etb;
899+ PyErr_Fetch(&etype, &eval, &etb);
900+ - ++Py_REFCNT(o);
901+ + Py_SET_REFCNT(o, Py_REFCNT(o)+1);
902+ __pyx_pw_6mtrand_11RandomState_3__dealloc__(o);
903+ - --Py_REFCNT(o);
904+ + Py_SET_REFCNT(o, Py_REFCNT(o)-1);
905+ PyErr_Restore(etype, eval, etb);
906+ }
907+ Py_CLEAR(p->lock);
0 commit comments