Imported Upstream version 1.22.4 upstream/1.22.4
authorDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 15 Jul 2022 02:14:56 +0000 (11:14 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 15 Jul 2022 02:14:56 +0000 (11:14 +0900)
52 files changed:
PKG-INFO
doc/changelog/1.22.4-changelog.rst [new file with mode: 0644]
doc/release/upcoming_changes/21154.improvement.rst [new file with mode: 0644]
doc/source/_static/numpy.css
doc/source/_templates/layout.html [deleted file]
doc/source/conf.py
doc/source/index.rst
doc/source/release.rst
doc/source/release/1.22.4-notes.rst [new file with mode: 0644]
doc/source/user/building.rst
doc_requirements.txt
environment.yml
numpy/_version.py
numpy/core/_add_newdocs.py
numpy/core/feature_detection_locale.h [new file with mode: 0644]
numpy/core/feature_detection_math.h [new file with mode: 0644]
numpy/core/feature_detection_misc.h [new file with mode: 0644]
numpy/core/feature_detection_stdio.h [new file with mode: 0644]
numpy/core/setup.py
numpy/core/setup_common.py
numpy/core/src/common/npy_cpu_features.c.src
numpy/core/src/multiarray/common.h
numpy/core/src/multiarray/convert_datatype.c
numpy/core/src/multiarray/ctors.c
numpy/core/src/multiarray/scalarapi.c
numpy/core/src/npymath/npy_math_private.h
numpy/core/src/umath/ufunc_object.c
numpy/core/tests/test_multiarray.py
numpy/core/tests/test_ufunc.py
numpy/distutils/ccompiler.py
numpy/distutils/ccompiler_opt.py
numpy/lib/__init__.pyi
numpy/lib/tests/test_io.py
numpy/linalg/setup.py
numpy/typing/__init__.py
numpy/typing/tests/data/mypy.ini
numpy/typing/tests/data/reveal/array_constructors.pyi
numpy/typing/tests/data/reveal/arrayterator.pyi
numpy/typing/tests/data/reveal/dtype.pyi
numpy/typing/tests/data/reveal/flatiter.pyi
numpy/typing/tests/data/reveal/fromnumeric.pyi
numpy/typing/tests/data/reveal/index_tricks.pyi
numpy/typing/tests/data/reveal/multiarray.pyi
numpy/typing/tests/data/reveal/ndarray_misc.pyi
numpy/typing/tests/data/reveal/nditer.pyi
numpy/typing/tests/data/reveal/numeric.pyi
numpy/typing/tests/data/reveal/stride_tricks.pyi
numpy/typing/tests/data/reveal/testing.pyi
pavement.py
pyproject.toml
test_requirements.txt
tools/cythonize.py

index a627aa34f4e6f479a810eba49ee17e4845163ca8..a9930fbc6b0be46b1ffd0bee6837f7c66b8e8191 100644 (file)
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: numpy
-Version: 1.22.3
+Version: 1.22.4
 Summary:  NumPy is the fundamental package for array computing with Python.
 Home-page: https://www.numpy.org
 Author: Travis E. Oliphant et al.
diff --git a/doc/changelog/1.22.4-changelog.rst b/doc/changelog/1.22.4-changelog.rst
new file mode 100644 (file)
index 0000000..0f3e54e
--- /dev/null
@@ -0,0 +1,47 @@
+
+Contributors
+============
+
+A total of 12 people contributed to this release.  People with a "+" by their
+names contributed a patch for the first time.
+
+* Alexander Shadchin
+* Bas van Beek
+* Charles Harris
+* Hood Chatham
+* Jarrod Millman
+* John-Mark Gurney +
+* Junyan Ou +
+* Mariusz Felisiak +
+* Ross Barnowski
+* Sebastian Berg
+* Serge Guelton
+* Stefan van der Walt
+
+Pull requests merged
+====================
+
+A total of 22 pull requests were merged for this release.
+
+* `#21191 <https://github.com/numpy/numpy/pull/21191>`__: TYP, BUG: Fix ``np.lib.stride_tricks`` re-exported under the...
+* `#21192 <https://github.com/numpy/numpy/pull/21192>`__: TST: Bump mypy from 0.931 to 0.940
+* `#21243 <https://github.com/numpy/numpy/pull/21243>`__: MAINT: Explicitly re-export the types in ``numpy._typing``
+* `#21245 <https://github.com/numpy/numpy/pull/21245>`__: MAINT: Specify sphinx, numpydoc versions for CI doc builds
+* `#21275 <https://github.com/numpy/numpy/pull/21275>`__: BUG: Fix typos
+* `#21277 <https://github.com/numpy/numpy/pull/21277>`__: ENH, BLD: Fix math feature detection for wasm
+* `#21350 <https://github.com/numpy/numpy/pull/21350>`__: MAINT: Fix failing simd and cygwin tests.
+* `#21438 <https://github.com/numpy/numpy/pull/21438>`__: MAINT: Fix failing Python 3.8 32-bit Windows test.
+* `#21444 <https://github.com/numpy/numpy/pull/21444>`__: BUG: add linux guard per #21386
+* `#21445 <https://github.com/numpy/numpy/pull/21445>`__: BUG: Allow legacy dtypes to cast to datetime again
+* `#21446 <https://github.com/numpy/numpy/pull/21446>`__: BUG: Make mmap handling safer in frombuffer
+* `#21447 <https://github.com/numpy/numpy/pull/21447>`__: BUG: Stop using PyBytesObject.ob_shash deprecated in Python 3.11.
+* `#21448 <https://github.com/numpy/numpy/pull/21448>`__: ENH: Introduce numpy.core.setup_common.NPY_CXX_FLAGS
+* `#21472 <https://github.com/numpy/numpy/pull/21472>`__: BUG: Ensure compile errors are raised correclty
+* `#21473 <https://github.com/numpy/numpy/pull/21473>`__: BUG: Fix segmentation fault
+* `#21474 <https://github.com/numpy/numpy/pull/21474>`__: MAINT: Update doc requirements
+* `#21475 <https://github.com/numpy/numpy/pull/21475>`__: MAINT: Mark ``npy_memchr`` with ``no_sanitize("alignment")`` on clang
+* `#21512 <https://github.com/numpy/numpy/pull/21512>`__: DOC: Proposal - make the doc landing page cards more similar...
+* `#21525 <https://github.com/numpy/numpy/pull/21525>`__: MAINT: Update Cython version to 0.29.30.
+* `#21536 <https://github.com/numpy/numpy/pull/21536>`__: BUG: Fix GCC error during build configuration
+* `#21541 <https://github.com/numpy/numpy/pull/21541>`__: REL: Prepare for the NumPy 1.22.4 release.
+* `#21547 <https://github.com/numpy/numpy/pull/21547>`__: MAINT: Skip tests that fail on PyPy.
diff --git a/doc/release/upcoming_changes/21154.improvement.rst b/doc/release/upcoming_changes/21154.improvement.rst
new file mode 100644 (file)
index 0000000..38630b4
--- /dev/null
@@ -0,0 +1,7 @@
+Math C library feature detection now uses correct signatures
+------------------------------------------------------------
+Compiling is preceded by a detection phase to determine whether the
+underlying libc supports certain math operations. Previously this code
+did not respect the proper signatures. Fixing this enables compilation
+for the ``wasm-ld`` backend (compilation for web assembly) and reduces
+the number of warnings.
index 53b610bf13d9f02cdeffa5d2181e622482a2f227..e0ccaadaff316f5cf7ac9770afdc8a351878014f 100644 (file)
@@ -32,3 +32,43 @@ h3 {
   color: #013243; /* warm black */
   letter-spacing: -.03em;
 }
+
+/* Main page overview cards */
+
+.intro-card {
+  background: #fff;
+  border-radius: 0;
+  padding: 30px 10px 20px 10px;
+  margin: 10px 0px;
+}
+
+.intro-card p.card-text {
+  margin: 0px;
+}
+
+.intro-card .card-img-top {
+  height: 52px;
+  width: 52px;
+  margin-left: auto;
+  margin-right: auto;
+}
+
+.intro-card .card-header {
+  border: none;
+  background-color: white;
+  color: #150458 !important;
+  font-size: var(--pst-font-size-h5);
+  font-weight: bold;
+  padding: 2.5rem 0rem 0.5rem 0rem;
+}
+
+.intro-card .card-footer {
+  border: none;
+  background-color: white;
+}
+
+.intro-card .card-footer p.card-text {
+  max-width: 220px;
+  margin-left: auto;
+  margin-right: auto;
+}
diff --git a/doc/source/_templates/layout.html b/doc/source/_templates/layout.html
deleted file mode 100644 (file)
index e2812fd..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-{% extends "!layout.html" %}
-
-{%- block extrahead %}
-{{ super() }}
-<link rel="stylesheet" href="{{ pathto('_static/numpy.css', 1) }}" type="text/css" />
-
-    <!-- PR #17220: This is added via javascript in versionwarning.js  -->
-    <!-- link rel="canonical" href="http://numpy.org/doc/stable/{{ pagename }}{{ file_suffix }}" / -->
-
-{% endblock %}
index 5b7c2a5e683fe76610226f793b165c5be7dd2868..c73d6d7bc1b60a8ddf7b919a8bad1a4cd79d38e4 100644 (file)
@@ -184,6 +184,11 @@ html_theme_options = {
 html_title = "%s v%s Manual" % (project, version)
 html_static_path = ['_static']
 html_last_updated_fmt = '%b %d, %Y'
+html_css_files = ["numpy.css"]
+
+# Prevent sphinx-panels from loading bootstrap css, the pydata-sphinx-theme
+# already loads it
+panels_add_bootstrap_css = False
 
 html_use_modindex = True
 html_copy_source = False
index a753a21f1594951f7e50f41705834a4b17d68a7b..1576d0672f300cc0a6ae0bd9b4689184576d1276 100644 (file)
@@ -11,6 +11,7 @@ NumPy documentation
    User Guide <user/index>
    API reference <reference/index>
    Development <dev/index>
+   release
 
 
 **Version**: |version|
@@ -35,7 +36,7 @@ basic statistical operations, random simulation and much more.
 
 .. panels::
     :card: + intro-card text-center
-    :column: col-lg-6 col-md-6 col-sm-6 col-xs-12 p-2
+    :column: col-lg-6 col-md-6 col-sm-6 col-xs-12 d-flex
 
     ---
     :img-top: ../source/_static/index-images/getting_started.svg
@@ -46,10 +47,12 @@ basic statistical operations, random simulation and much more.
     New to NumPy? Check out the Absolute Beginner's Guide. It contains an
     introduction to NumPy's main concepts and links to additional tutorials.
 
+    +++
+
     .. link-button:: user/absolute_beginners
         :type: ref
-        :text: 
-        :classes: stretched-link
+        :text: To the absolute beginner's guide
+        :classes: btn-block btn-secondary stretched-link
     
     ---
     :img-top: ../source/_static/index-images/user_guide.svg
@@ -60,10 +63,12 @@ basic statistical operations, random simulation and much more.
     The user guide provides in-depth information on the
     key concepts of NumPy with useful background information and explanation.
 
+    +++
+
     .. link-button:: user
         :type: ref
-        :text: 
-        :classes: stretched-link
+        :text: To the user guide
+        :classes: btn-block btn-secondary stretched-link
 
     ---
     :img-top: ../source/_static/index-images/api.svg
@@ -76,25 +81,29 @@ basic statistical operations, random simulation and much more.
     methods work and which parameters can be used. It assumes that you have an
     understanding of the key concepts.
 
+    +++
+
     .. link-button:: reference
         :type: ref
-        :text: 
-        :classes: stretched-link 
+        :text: To the reference guide
+        :classes: btn-block btn-secondary stretched-link
 
     ---
     :img-top: ../source/_static/index-images/contributor.svg
 
     Contributor's Guide
-    ^^^^^^^^^^^^^^^
+    ^^^^^^^^^^^^^^^^^^^
 
     Want to add to the codebase? Can help add translation or a flowchart to the
     documentation? The contributing guidelines will guide you through the
     process of improving NumPy.
 
+    +++
+
     .. link-button:: devindex
         :type: ref
-        :text: 
-        :classes: stretched-link
+        :text: To the contributor's guide
+        :classes: btn-block btn-secondary stretched-link
 
 .. This is not really the index page, that is found in
    _templates/indexcontent.html The toctree content here will be added to the
index 0f5d876baf6b446d9365235127e4b9cd07ea490c..3474e0a48b0116ebd361d43506ab65c984408667 100644 (file)
@@ -5,6 +5,7 @@ Release notes
 .. toctree::
     :maxdepth: 3
 
+    1.22.4 <release/1.22.4-notes>
     1.22.3 <release/1.22.3-notes>
     1.22.2 <release/1.22.2-notes>
     1.22.1 <release/1.22.1-notes>
diff --git a/doc/source/release/1.22.4-notes.rst b/doc/source/release/1.22.4-notes.rst
new file mode 100644 (file)
index 0000000..a13d0a8
--- /dev/null
@@ -0,0 +1,62 @@
+.. currentmodule:: numpy
+
+==========================
+NumPy 1.22.4 Release Notes
+==========================
+
+NumPy 1.22.4 is a maintenance release that fixes bugs discovered after the
+1.22.3 release. In addition, the wheels for this release are built using the
+recently released Cython 0.29.30, which should fix the reported problems with
+`debugging <https://github.com/numpy/numpy/issues/21008>`_.
+
+The Python versions supported for this release are 3.8-3.10. Note that the Mac
+wheels are now based on OS X 10.14 rather than 10.6 that was used in previous
+NumPy release cycles. 10.14 is the oldest release supported by Apple.
+
+Contributors
+============
+
+A total of 12 people contributed to this release.  People with a "+" by their
+names contributed a patch for the first time.
+
+* Alexander Shadchin
+* Bas van Beek
+* Charles Harris
+* Hood Chatham
+* Jarrod Millman
+* John-Mark Gurney +
+* Junyan Ou +
+* Mariusz Felisiak +
+* Ross Barnowski
+* Sebastian Berg
+* Serge Guelton
+* Stefan van der Walt
+
+Pull requests merged
+====================
+
+A total of 22 pull requests were merged for this release.
+
+* `#21191 <https://github.com/numpy/numpy/pull/21191>`__: TYP, BUG: Fix ``np.lib.stride_tricks`` re-exported under the...
+* `#21192 <https://github.com/numpy/numpy/pull/21192>`__: TST: Bump mypy from 0.931 to 0.940
+* `#21243 <https://github.com/numpy/numpy/pull/21243>`__: MAINT: Explicitly re-export the types in ``numpy._typing``
+* `#21245 <https://github.com/numpy/numpy/pull/21245>`__: MAINT: Specify sphinx, numpydoc versions for CI doc builds
+* `#21275 <https://github.com/numpy/numpy/pull/21275>`__: BUG: Fix typos
+* `#21277 <https://github.com/numpy/numpy/pull/21277>`__: ENH, BLD: Fix math feature detection for wasm
+* `#21350 <https://github.com/numpy/numpy/pull/21350>`__: MAINT: Fix failing simd and cygwin tests.
+* `#21438 <https://github.com/numpy/numpy/pull/21438>`__: MAINT: Fix failing Python 3.8 32-bit Windows test.
+* `#21444 <https://github.com/numpy/numpy/pull/21444>`__: BUG: add linux guard per #21386
+* `#21445 <https://github.com/numpy/numpy/pull/21445>`__: BUG: Allow legacy dtypes to cast to datetime again
+* `#21446 <https://github.com/numpy/numpy/pull/21446>`__: BUG: Make mmap handling safer in frombuffer
+* `#21447 <https://github.com/numpy/numpy/pull/21447>`__: BUG: Stop using PyBytesObject.ob_shash deprecated in Python 3.11.
+* `#21448 <https://github.com/numpy/numpy/pull/21448>`__: ENH: Introduce numpy.core.setup_common.NPY_CXX_FLAGS
+* `#21472 <https://github.com/numpy/numpy/pull/21472>`__: BUG: Ensure compile errors are raised correclty
+* `#21473 <https://github.com/numpy/numpy/pull/21473>`__: BUG: Fix segmentation fault
+* `#21474 <https://github.com/numpy/numpy/pull/21474>`__: MAINT: Update doc requirements
+* `#21475 <https://github.com/numpy/numpy/pull/21475>`__: MAINT: Mark ``npy_memchr`` with ``no_sanitize("alignment")`` on clang
+* `#21512 <https://github.com/numpy/numpy/pull/21512>`__: DOC: Proposal - make the doc landing page cards more similar...
+* `#21525 <https://github.com/numpy/numpy/pull/21525>`__: MAINT: Update Cython version to 0.29.30.
+* `#21536 <https://github.com/numpy/numpy/pull/21536>`__: BUG: Fix GCC error during build configuration
+* `#21541 <https://github.com/numpy/numpy/pull/21541>`__: REL: Prepare for the NumPy 1.22.4 release.
+* `#21547 <https://github.com/numpy/numpy/pull/21547>`__: MAINT: Skip tests that fail on PyPy.
+
index 22efca4a6f8344f16ad63690d25fec841b9dee86..01ec65d3b6b3ed9c6443793253f176d449004e16 100644 (file)
@@ -48,6 +48,9 @@ Building NumPy requires the following software installed:
    Much of NumPy is written in C.  You will need a C compiler that complies
    with the C99 standard.
 
+   Part of Numpy is now written in C++. You will also need a C++ compiler that
+   complies with the C++11 standard.
+
    While a FORTRAN 77 compiler is not necessary for building NumPy, it is
    needed to run the ``numpy.f2py`` tests. These tests are skipped if the
    compiler is not auto-detected.
index 9cc8d954979496d3e32f9b3123d6d23d302a4a11..dbc9f40cd1efaf8c753e1c944b4c30613bed6d80 100644 (file)
@@ -1,7 +1,7 @@
 # doxygen required, use apt-get or dnf
-sphinx==4.2.0
-numpydoc==1.1.0
-pydata-sphinx-theme==0.7.2
+sphinx==4.5.0
+numpydoc==1.3.1
+pydata-sphinx-theme==0.8.1
 sphinx-panels
 ipython!=8.1.0
 scipy
index 58305e68171c815dda5cbc68f4588a5de4557909..e63fe87617e34e8ef89ee9a664340f5e8e47e7d8 100644 (file)
@@ -7,8 +7,8 @@ name: numpy-dev
 channels:
   - conda-forge
 dependencies:
-  - python
-  - cython
+  - python=3.9 #need to pin to avoid issues with builds
+  - cython=0.29.30
   - compilers
   - openblas
   - nomkl
@@ -19,16 +19,18 @@ dependencies:
   - pytest-xdist
   - hypothesis
   # For type annotations
-  - mypy=0.930
+  - mypy=0.940
   # For building docs
-  - sphinx=4.1.1
-  - numpydoc=1.1.0
+  - sphinx=4.5.0
+  - sphinx-panels
+  - numpydoc=1.3.1
   - ipython
   - scipy
   - pandas
   - matplotlib
-  - pydata-sphinx-theme
-  - breathe
+  - pydata-sphinx-theme=0.8.1
+  # NOTE: breathe 4.33.0 collides with sphinx.ext.graphviz
+  - breathe!=4.33.0
   # For linting
   - pycodestyle=2.7.0
   - gitpython
index 4272f36d0a6008ade242ee9aba7750335b49a2b3..92f62350bddd630b9ad5d21c6d8b1021491287bb 100644 (file)
@@ -8,11 +8,11 @@ import json
 
 version_json = '''
 {
- "date": "2022-03-07T12:27:54-0700",
+ "date": "2022-05-20T10:57:06-0600",
  "dirty": false,
  "error": null,
- "full-revisionid": "7d4349e332fcba2bc3f266267421531b3ec5d3e6",
- "version": "1.22.3"
+ "full-revisionid": "08772f91455db66810995db5e9d0671f91e027ed",
+ "version": "1.22.4"
 }
 '''  # END VERSION_JSON
 
index 078c5897678c5f1b95f501bb0473f317ddc559b4..af9682c03f77590bf34dd36f701ffcf2d027ce6e 100644 (file)
@@ -1557,6 +1557,10 @@ add_newdoc('numpy.core.multiarray', 'frombuffer',
     The data of the resulting array will not be byteswapped, but will be
     interpreted correctly.
 
+    This function creates a view into the original object.  This should be safe
+    in general, but it may make sense to copy the result when the original
+    object is mutable or untrusted.
+
     Examples
     --------
     >>> s = b'hello world'
diff --git a/numpy/core/feature_detection_locale.h b/numpy/core/feature_detection_locale.h
new file mode 100644 (file)
index 0000000..59e7893
--- /dev/null
@@ -0,0 +1,2 @@
+#pragma GCC diagnostic ignored "-Wnonnull"
+long double strtold_l(const char*, char**, locale_t);
diff --git a/numpy/core/feature_detection_math.h b/numpy/core/feature_detection_math.h
new file mode 100644 (file)
index 0000000..27ad7bc
--- /dev/null
@@ -0,0 +1,107 @@
+double expm1(double);
+double log1p(double);
+double acosh(double);
+double asinh(double);
+double atanh(double);
+double rint(double);
+double trunc(double);
+double exp2(double);
+double log2(double);
+double hypot(double, double);
+double atan2(double, double);
+double pow(double, double);
+double copysign(double, double);
+double nextafter(double, double);
+long long strtoll(const char*, char**, int);
+unsigned long long strtoull(const char*, char**, int);
+double cbrt(double);
+long double sinl(long double);
+long double cosl(long double);
+long double tanl(long double);
+long double sinhl(long double);
+long double coshl(long double);
+long double tanhl(long double);
+long double fabsl(long double);
+long double floorl(long double);
+long double ceill(long double);
+long double rintl(long double);
+long double truncl(long double);
+long double sqrtl(long double);
+long double log10l(long double);
+long double logl(long double);
+long double log1pl(long double);
+long double expl(long double);
+long double expm1l(long double);
+long double asinl(long double);
+long double acosl(long double);
+long double atanl(long double);
+long double asinhl(long double);
+long double acoshl(long double);
+long double atanhl(long double);
+long double hypotl(long double, long double);
+long double atan2l(long double, long double);
+long double powl(long double, long double);
+long double fmodl(long double, long double);
+long double modfl(long double, long double*);
+long double frexpl(long double, int*);
+long double ldexpl(long double, int);
+long double exp2l(long double);
+long double log2l(long double);
+long double copysignl(long double, long double);
+long double nextafterl(long double, long double);
+long double cbrtl(long double);
+float sinf(float);
+float cosf(float);
+float tanf(float);
+float sinhf(float);
+float coshf(float);
+float tanhf(float);
+float fabsf(float);
+float floorf(float);
+float ceilf(float);
+float rintf(float);
+float truncf(float);
+float sqrtf(float);
+float log10f(float);
+float logf(float);
+float log1pf(float);
+float expf(float);
+float expm1f(float);
+float asinf(float);
+float acosf(float);
+float atanf(float);
+float asinhf(float);
+float acoshf(float);
+float atanhf(float);
+float hypotf(float, float);
+float atan2f(float, float);
+float powf(float, float);
+float fmodf(float, float);
+float modff(float, float*);
+float frexpf(float, int*);
+float ldexpf(float, int);
+float exp2f(float);
+float log2f(float);
+float copysignf(float, float);
+float nextafterf(float, float);
+float cbrtf(float);
+double sin(double);
+double cos(double);
+double tan(double);
+double sinh(double);
+double cosh(double);
+double tanh(double);
+double fabs(double);
+double floor(double);
+double ceil(double);
+double sqrt(double);
+double log10(double);
+double log(double);
+double exp(double);
+double asin(double);
+double acos(double);
+double atan(double);
+double fmod(double, double);
+double modf(double, double*);
+double frexp(double, int*);
+double ldexp(double, int);
diff --git a/numpy/core/feature_detection_misc.h b/numpy/core/feature_detection_misc.h
new file mode 100644 (file)
index 0000000..f58cf4b
--- /dev/null
@@ -0,0 +1,4 @@
+#include <stddef.h>
+
+int backtrace(void **, int);
+int madvise(void *, size_t, int);
diff --git a/numpy/core/feature_detection_stdio.h b/numpy/core/feature_detection_stdio.h
new file mode 100644 (file)
index 0000000..bc14d16
--- /dev/null
@@ -0,0 +1,6 @@
+#include <stdio.h>
+#include <fcntl.h>
+
+off_t ftello(FILE *stream);
+int fseeko(FILE *stream, off_t offset, int whence);
+int fallocate(int, int, off_t, off_t);
index 7eb08132e2b2997ff599133be80d47f0eb0dc36e..157c825d2a1e289f22356774249f4577399dfaea 100644 (file)
@@ -125,32 +125,48 @@ def win32_checks(deflist):
         deflist.append('FORCE_NO_LONG_DOUBLE_FORMATTING')
 
 def check_math_capabilities(config, ext, moredefs, mathlibs):
-    def check_func(func_name):
-        return config.check_func(func_name, libraries=mathlibs,
-                                 decl=True, call=True)
-
-    def check_funcs_once(funcs_name):
-        decl = dict([(f, True) for f in funcs_name])
-        st = config.check_funcs_once(funcs_name, libraries=mathlibs,
-                                     decl=decl, call=decl)
+    def check_func(
+        func_name,
+        decl=False,
+        headers=["feature_detection_math.h"],
+    ):
+        return config.check_func(
+            func_name,
+            libraries=mathlibs,
+            decl=decl,
+            call=True,
+            call_args=FUNC_CALL_ARGS[func_name],
+            headers=headers,
+        )
+
+    def check_funcs_once(funcs_name, headers=["feature_detection_math.h"]):
+        call = dict([(f, True) for f in funcs_name])
+        call_args = dict([(f, FUNC_CALL_ARGS[f]) for f in funcs_name])
+        st = config.check_funcs_once(
+            funcs_name,
+            libraries=mathlibs,
+            decl=False,
+            call=call,
+            call_args=call_args,
+            headers=headers,
+        )
         if st:
             moredefs.extend([(fname2def(f), 1) for f in funcs_name])
         return st
 
-    def check_funcs(funcs_name):
+    def check_funcs(funcs_name, headers=["feature_detection_math.h"]):
         # Use check_funcs_once first, and if it does not work, test func per
         # func. Return success only if all the functions are available
-        if not check_funcs_once(funcs_name):
+        if not check_funcs_once(funcs_name, headers=headers):
             # Global check failed, check func per func
             for f in funcs_name:
-                if check_func(f):
+                if check_func(f, headers=headers):
                     moredefs.append((fname2def(f), 1))
             return 0
         else:
             return 1
 
     #use_msvc = config.check_decl("_MSC_VER")
-
     if not check_funcs_once(MANDATORY_FUNCS):
         raise SystemError("One of the required function to build numpy is not"
                 " available (the list is %s)." % str(MANDATORY_FUNCS))
@@ -165,15 +181,34 @@ def check_math_capabilities(config, ext, moredefs, mathlibs):
     for f in OPTIONAL_STDFUNCS_MAYBE:
         if config.check_decl(fname2def(f),
                     headers=["Python.h", "math.h"]):
-            OPTIONAL_STDFUNCS.remove(f)
+            if f in OPTIONAL_STDFUNCS:
+                OPTIONAL_STDFUNCS.remove(f)
+            else:
+                OPTIONAL_FILE_FUNCS.remove(f)
+
 
     check_funcs(OPTIONAL_STDFUNCS)
+    check_funcs(OPTIONAL_FILE_FUNCS, headers=["feature_detection_stdio.h"])
+    check_funcs(OPTIONAL_MISC_FUNCS, headers=["feature_detection_misc.h"])
+    
+
 
     for h in OPTIONAL_HEADERS:
         if config.check_func("", decl=False, call=False, headers=[h]):
             h = h.replace(".", "_").replace(os.path.sep, "_")
             moredefs.append((fname2def(h), 1))
 
+    # Try with both "locale.h" and "xlocale.h"
+    locale_headers = [
+        "stdlib.h",
+        "xlocale.h",
+        "feature_detection_locale.h",
+    ]
+    if not check_funcs(OPTIONAL_LOCALE_FUNCS, headers=locale_headers):
+        # It didn't work with xlocale.h, maybe it will work with locale.h?
+        locale_headers[1] = "locale.h"
+        check_funcs(OPTIONAL_LOCALE_FUNCS, headers=locale_headers)
+
     for tup in OPTIONAL_INTRINSICS:
         headers = None
         if len(tup) == 2:
@@ -394,20 +429,28 @@ def check_types(config_cmd, ext, build_dir):
 def check_mathlib(config_cmd):
     # Testing the C math library
     mathlibs = []
-    mathlibs_choices = [[], ['m'], ['cpml']]
-    mathlib = os.environ.get('MATHLIB')
+    mathlibs_choices = [[], ["m"], ["cpml"]]
+    mathlib = os.environ.get("MATHLIB")
     if mathlib:
-        mathlibs_choices.insert(0, mathlib.split(','))
+        mathlibs_choices.insert(0, mathlib.split(","))
     for libs in mathlibs_choices:
-        if config_cmd.check_func("exp", libraries=libs, decl=True, call=True):
+        if config_cmd.check_func(
+            "log",
+            libraries=libs,
+            call_args="0",
+            decl="double log(double);",
+            call=True
+        ):
             mathlibs = libs
             break
     else:
         raise RuntimeError(
             "math library missing; rerun setup.py after setting the "
-            "MATHLIB env variable")
+            "MATHLIB env variable"
+        )
     return mathlibs
 
+
 def visibility_define(config):
     """Return the define value to use for NPY_VISIBILITY_HIDDEN (may be empty
     string)."""
@@ -418,15 +461,18 @@ def visibility_define(config):
         return ''
 
 def configuration(parent_package='',top_path=None):
-    from numpy.distutils.misc_util import Configuration, dot_join
+    from numpy.distutils.misc_util import (Configuration, dot_join,
+                                           exec_mod_from_location)
     from numpy.distutils.system_info import (get_info, blas_opt_info,
                                              lapack_opt_info)
+    from numpy.distutils.ccompiler_opt import NPY_CXX_FLAGS
+    from numpy.version import release as is_released
 
     config = Configuration('core', parent_package, top_path)
     local_dir = config.local_path
     codegen_dir = join(local_dir, 'code_generators')
 
-    if is_released(config):
+    if is_released:
         warnings.simplefilter('error', MismatchCAPIWarning)
 
     # Check whether we have a mismatch between the set C API VERSION and the
@@ -435,8 +481,8 @@ def configuration(parent_package='',top_path=None):
 
     generate_umath_py = join(codegen_dir, 'generate_umath.py')
     n = dot_join(config.name, 'generate_umath')
-    generate_umath = npy_load_module('_'.join(n.split('.')),
-                                     generate_umath_py, ('.py', 'U', 1))
+    generate_umath = exec_mod_from_location('_'.join(n.split('.')),
+                                            generate_umath_py)
 
     header_dir = 'include/numpy'  # this is relative to config.path_in_package
 
@@ -695,11 +741,17 @@ def configuration(parent_package='',top_path=None):
         ):
             is_cpp = lang == 'c++'
             if is_cpp:
-                # this a workround to get rid of invalid c++ flags
+                # this a workaround to get rid of invalid c++ flags
                 # without doing big changes to config.
                 # c tested first, compiler should be here
                 bk_c = config_cmd.compiler
                 config_cmd.compiler = bk_c.cxx_compiler()
+
+                # Check that Linux compiler actually support the default flags
+                if hasattr(config_cmd.compiler, 'compiler'):
+                    config_cmd.compiler.compiler.extend(NPY_CXX_FLAGS)
+                    config_cmd.compiler.compiler_so.extend(NPY_CXX_FLAGS)
+
             st = config_cmd.try_link(test_code, lang=lang)
             if not st:
                 # rerun the failing command in verbose mode
@@ -1037,10 +1089,7 @@ def configuration(parent_package='',top_path=None):
                          libraries=['npymath'],
                          extra_objects=svml_objs,
                          extra_info=extra_info,
-                         extra_cxx_compile_args=['-std=c++11',
-                                                 '-D__STDC_VERSION__=0',
-                                                 '-fno-exceptions',
-                                                 '-fno-rtti'])
+                         extra_cxx_compile_args=NPY_CXX_FLAGS)
 
     #######################################################################
     #                        umath_tests module                           #
index 70e8fc89705add792e19fde1e83a3cba5b01cd75..181c58fb1219a73979b906af43816508a0c0dd16 100644 (file)
@@ -1,8 +1,9 @@
 # Code common to build tools
-import sys
-import warnings
 import copy
+import pathlib
+import sys
 import textwrap
+import warnings
 
 from numpy.distutils.misc_util import mingw32
 
@@ -101,6 +102,32 @@ def check_api_version(apiversion, codegen_dir):
         warnings.warn(msg % (apiversion, curapi_hash, apiversion, api_hash,
                              __file__),
                       MismatchCAPIWarning, stacklevel=2)
+
+
+FUNC_CALL_ARGS = {}
+
+def set_sig(sig):
+    prefix, _, args = sig.partition("(")
+    args = args.rpartition(")")[0]
+    funcname = prefix.rpartition(" ")[-1]
+    args = [arg.strip() for arg in args.split(",")]
+    FUNC_CALL_ARGS[funcname] = ", ".join("(%s) 0" % arg for arg in args)
+
+
+for file in [
+    "feature_detection_locale.h",
+    "feature_detection_math.h",
+    "feature_detection_misc.h",
+    "feature_detection_stdio.h",
+]:
+    with open(pathlib.Path(__file__).parent / file) as f:
+        for line in f:
+            if line.startswith("#"):
+                continue
+            if not line.strip():
+                continue
+            set_sig(line)
+
 # Mandatory functions: if not found, fail the build
 MANDATORY_FUNCS = ["sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs",
         "floor", "ceil", "sqrt", "log10", "log", "exp", "asin",
@@ -110,9 +137,11 @@ MANDATORY_FUNCS = ["sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs",
 # replacement implementation. Note that some of these are C99 functions.
 OPTIONAL_STDFUNCS = ["expm1", "log1p", "acosh", "asinh", "atanh",
         "rint", "trunc", "exp2", "log2", "hypot", "atan2", "pow",
-        "copysign", "nextafter", "ftello", "fseeko",
-        "strtoll", "strtoull", "cbrt", "strtold_l", "fallocate",
-        "backtrace", "madvise"]
+        "copysign", "nextafter", "strtoll", "strtoull", "cbrt"]
+
+OPTIONAL_LOCALE_FUNCS = ["strtold_l"]
+OPTIONAL_FILE_FUNCS = ["ftello", "fseeko", "fallocate"]
+OPTIONAL_MISC_FUNCS = ["backtrace", "madvise"]
 
 
 OPTIONAL_HEADERS = [
index a2383c45f61d49dc407833e1a5ead6c31510bfd9..0bdc046b7fade750893efb84dc6cca5bf2fba62d 100644 (file)
@@ -530,7 +530,9 @@ npy__cpu_init_features_arm8(void)
 #include <stdio.h>
 #include "npy_cpuinfo_parser.h"
 
+#if defined(__linux__)
 __attribute__((weak)) unsigned long getauxval(unsigned long); // linker should handle it
+#endif
 #ifdef __FreeBSD__
 __attribute__((weak)) int elf_aux_info(int, void *, int); // linker should handle it
 
index 85fd3aab1f40f5ca3e33b8b3c446f536a6a2d839..ed022e4f8370290a652d3d030469818766c3b76d 100644 (file)
@@ -248,6 +248,15 @@ npy_uint_alignment(int itemsize)
  * compared to memchr it returns one stride past end instead of NULL if needle
  * is not found.
  */
+#ifdef __clang__
+    /*
+     * The code below currently makes use of !NPY_ALIGNMENT_REQUIRED, which
+     * should be OK but causes the clang sanitizer to warn.  It may make
+     * sense to modify the code to avoid this "unaligned" access but
+     * it would be good to carefully check the performance changes.
+     */
+    __attribute__((no_sanitize("alignment")))
+#endif
 static NPY_INLINE char *
 npy_memchr(char * haystack, char needle,
            npy_intp stride, npy_intp size, npy_intp * psubloopsize, int invert)
index 3135d69894b3efb048724aa8320e8b986d54a710..5d215a647f8a0787116eb3414b66527db6e079f0 100644 (file)
@@ -106,9 +106,6 @@ PyArray_GetCastingImpl(PyArray_DTypeMeta *from, PyArray_DTypeMeta *to)
         return NULL;
     }
     else {
-        if (NPY_DT_is_parametric(from) || NPY_DT_is_parametric(to)) {
-            Py_RETURN_NONE;
-        }
         /* Reject non-legacy dtypes (they need to use the new API) */
         if (!NPY_DT_is_legacy(from) || !NPY_DT_is_legacy(to)) {
             Py_RETURN_NONE;
index 4464d7ead51def0229ac1316e15035fe4cda5063..c5a7ebf7dec97c9b916308632a85ba8ca1e550df 100644 (file)
@@ -3684,28 +3684,44 @@ PyArray_FromBuffer(PyObject *buf, PyArray_Descr *type,
         return NULL;
     }
 
+    /*
+     * The array check is probably unnecessary.  It preserves the base for
+     * arrays.  This is the "old" buffer protocol, which had no release logic.
+     * (It was assumed that the result is always a view.)
+     *
+     * NOTE: We could also check if `bf_releasebuffer` is defined which should
+     *       be the most precise and safe thing to do.  But that should only be
+     *       necessary if unexpected backcompat issues are found downstream.
+     */
+    if (!PyArray_Check(buf)) {
+        buf = PyMemoryView_FromObject(buf);
+        if (buf == NULL) {
+            return NULL;
+        }
+    }
+    else {
+        Py_INCREF(buf);
+    }
+
     if (PyObject_GetBuffer(buf, &view, PyBUF_WRITABLE|PyBUF_SIMPLE) < 0) {
         writeable = 0;
         PyErr_Clear();
         if (PyObject_GetBuffer(buf, &view, PyBUF_SIMPLE) < 0) {
+            Py_DECREF(buf);
             Py_DECREF(type);
             return NULL;
         }
     }
     data = (char *)view.buf;
     ts = view.len;
-    /*
-     * In Python 3 both of the deprecated functions PyObject_AsWriteBuffer and
-     * PyObject_AsReadBuffer that this code replaces release the buffer. It is
-     * up to the object that supplies the buffer to guarantee that the buffer
-     * sticks around after the release.
-     */
+    /* `buf` is an array or a memoryview; so we know `view` does not own data */
     PyBuffer_Release(&view);
 
     if ((offset < 0) || (offset > ts)) {
         PyErr_Format(PyExc_ValueError,
                      "offset must be non-negative and no greater than buffer "\
                      "length (%" NPY_INTP_FMT ")", (npy_intp)ts);
+        Py_DECREF(buf);
         Py_DECREF(type);
         return NULL;
     }
@@ -3718,6 +3734,7 @@ PyArray_FromBuffer(PyObject *buf, PyArray_Descr *type,
         if (itemsize == 0) {
             PyErr_SetString(PyExc_ValueError,
                             "cannot determine count if itemsize is 0");
+            Py_DECREF(buf);
             Py_DECREF(type);
             return NULL;
         }
@@ -3725,6 +3742,7 @@ PyArray_FromBuffer(PyObject *buf, PyArray_Descr *type,
             PyErr_SetString(PyExc_ValueError,
                             "buffer size must be a multiple"\
                             " of element size");
+            Py_DECREF(buf);
             Py_DECREF(type);
             return NULL;
         }
@@ -3735,6 +3753,7 @@ PyArray_FromBuffer(PyObject *buf, PyArray_Descr *type,
             PyErr_SetString(PyExc_ValueError,
                             "buffer is smaller than requested"\
                             " size");
+            Py_DECREF(buf);
             Py_DECREF(type);
             return NULL;
         }
@@ -3744,6 +3763,7 @@ PyArray_FromBuffer(PyObject *buf, PyArray_Descr *type,
             &PyArray_Type, type,
             1, &n, NULL, data,
             NPY_ARRAY_DEFAULT, NULL, buf);
+    Py_DECREF(buf);
     if (ret == NULL) {
         return NULL;
     }
index edbe5955ce97c746fe54b15cdda0c31d63f93944..4d4b4bccb0e49861ae4d762e5236004e6729e44e 100644 (file)
@@ -773,7 +773,9 @@ PyArray_Scalar(void *data, PyArray_Descr *descr, PyObject *base)
     if (PyTypeNum_ISFLEXIBLE(type_num)) {
         if (type_num == NPY_STRING) {
             destptr = PyBytes_AS_STRING(obj);
-            ((PyBytesObject *)obj)->ob_shash = -1;
+            #if PY_VERSION_HEX < 0x030b00b0
+                ((PyBytesObject *)obj)->ob_shash = -1;
+            #endif
             memcpy(destptr, data, itemsize);
             return obj;
         }
index 7ca0c5ba0f83d3ea495ce88eed9fa05350e8ab51..a474b3de38644e1367b2eaa5e4a515264a06824b 100644 (file)
@@ -514,7 +514,7 @@ typedef union {
 typedef union {
         npy_cdouble npy_z;
 #ifdef __cplusplus
-        std::complex<double> c99z;
+        std::complex<double> c99_z;
 #else
         complex double c99_z;
 #endif
@@ -523,7 +523,7 @@ typedef union {
 typedef union {
         npy_cfloat npy_z;
 #ifdef __cplusplus
-        std::complex<float> c99z;
+        std::complex<float> c99_z;
 #else
         complex float c99_z;
 #endif
index 1772eb250271674f0c29823cae02f81e54f20088..aeca872dd6407a4ecb3c235db622e69cba0a5eea 100644 (file)
@@ -5884,6 +5884,13 @@ ufunc_at(PyUFuncObject *ufunc, PyObject *args)
 
     NPY_BEGIN_THREADS_DEF;
 
+    if (ufunc->core_enabled) {
+        PyErr_Format(PyExc_TypeError,
+            "%s.at does not support ufunc with non-trivial signature: %s has signature %s.",
+            ufunc->name, ufunc->name, ufunc->core_signature);
+        return NULL;
+    }
+
     if (ufunc->nin > 2) {
         PyErr_SetString(PyExc_ValueError,
             "Only unary and binary ufuncs supported at this time");
index b8fd1f319f9e11cdfc3689b85ab479899b41b667..35acf307fc910f523b3b3a421316c514feb318fb 100644 (file)
@@ -18,6 +18,7 @@ from numpy.compat import pickle
 import pathlib
 import builtins
 from decimal import Decimal
+import mmap
 
 import numpy as np
 import numpy.core._multiarray_tests as _multiarray_tests
@@ -5349,9 +5350,32 @@ class TestFromBuffer:
         buf = x.tobytes()
         assert_array_equal(np.frombuffer(buf, dtype=dt), x.flat)
 
+    def test_array_base(self):
+        arr = np.arange(10)
+        new = np.frombuffer(arr)
+        # We currently special case arrays to ensure they are used as a base.
+        # This could probably be changed (removing the test).
+        assert new.base is arr
+
     def test_empty(self):
         assert_array_equal(np.frombuffer(b''), np.array([]))
 
+    @pytest.mark.skipif(IS_PYPY,
+            reason="PyPy's memoryview currently does not track exports. See: "
+                   "https://foss.heptapod.net/pypy/pypy/-/issues/3724")
+    def test_mmap_close(self):
+        # The old buffer protocol was not safe for some things that the new
+        # one is.  But `frombuffer` always used the old one for a long time.
+        # Checks that it is safe with the new one (using memoryviews)
+        with tempfile.TemporaryFile(mode='wb') as tmp:
+            tmp.write(b"asdf")
+            tmp.flush()
+            mm = mmap.mmap(tmp.fileno(), 0)
+            arr = np.frombuffer(mm, dtype=np.uint8)
+            with pytest.raises(BufferError):
+                mm.close()  # cannot close while array uses the buffer
+            del arr
+            mm.close()
 
 class TestFlat:
     def setup(self):
index 6c56e631590ea824f6b2d0bdfe6326b9ca3a67d1..292797c6d41144a270dfca33f6e171dcf5a5cdb3 100644 (file)
@@ -389,7 +389,7 @@ class TestUfunc:
         assert_equal(ixs, (0, 0, 0, 1, 2))
         assert_equal(flags, (self.can_ignore, self.size_inferred, 0))
         assert_equal(sizes, (3, -1, 9))
-    
+
     def test_signature9(self):
         enabled, num_dims, ixs, flags, sizes = umt.test_signature(
             1, 1, "(  3)  -> ( )")
@@ -2002,6 +2002,20 @@ class TestUfunc:
         # Test multiple output ufuncs raise error, gh-5665
         assert_raises(ValueError, np.modf.at, np.arange(10), [1])
 
+        # Test maximum
+        a = np.array([1, 2, 3])
+        np.maximum.at(a, [0], 0)
+        assert_equal(np.array([1, 2, 3]), a)
+
+    def test_at_not_none_signature(self):
+        # Test ufuncs with non-trivial signature raise a TypeError
+        a = np.ones((2, 2, 2))
+        b = np.ones((1, 2, 2))
+        assert_raises(TypeError, np.matmul.at, a, [0], b)
+
+        a = np.array([[[1, 2], [3, 4]]])
+        assert_raises(TypeError, np.linalg._umath_linalg.det.at, a, [0])
+
     def test_reduce_arguments(self):
         f = np.add.reduce
         d = np.ones((5,2), dtype=int)
index 74e2c51f600c7a229f2794472fd56313be396133..0bc34326c59ffb24b013edcb121cfbefc1aa67e7 100644 (file)
@@ -357,7 +357,8 @@ def CCompiler_compile(self, sources, output_dir=None, macros=None,
         # build parallel
         from concurrent.futures import ThreadPoolExecutor
         with ThreadPoolExecutor(jobs) as pool:
-            pool.map(single_compile, build_items)
+            res = pool.map(single_compile, build_items)
+        list(res)  # access result to raise errors
     else:
         # build serial
         for o in build_items:
index b38e47c13a94c356302a72b3024d1703f8d44d0c..205a8e060f6932e7558942ec35515569280b4ed1 100644 (file)
@@ -16,6 +16,14 @@ import re
 import subprocess
 import textwrap
 
+# These flags are used to compile any C++ source within Numpy.
+# They are chosen to have very few runtime dependencies.
+NPY_CXX_FLAGS = [
+    '-std=c++11',  # Minimal standard version
+    '-D__STDC_VERSION__=0',  # for compatibility with C headers
+    '-fno-exceptions',  # no exception support
+    '-fno-rtti']  # no runtime type information
+
 
 class _Config:
     """An abstract class holds all configurable attributes of `CCompilerOpt`,
index ae23b2ec4980c2e7fdfba426843018d0029e08ef..f6ec673ec178945bc822309d3f325b1fc12a7c45 100644 (file)
@@ -14,7 +14,7 @@ from numpy.lib import (
     format as format,
     mixins as mixins,
     scimath as scimath,
-    stride_tricks as stride_stricks,
+    stride_tricks as stride_tricks,
 )
 
 from numpy.lib._version import (
index 5201b8e6e33f635ffd2afb1243e77dacdab47bab..ce345fa8218deca915d9c1866b8bb715eacaf92a 100644 (file)
@@ -203,6 +203,7 @@ class TestSavezLoad(RoundtripTest):
                 self.arr_reloaded.fid.close()
                 os.remove(self.arr_reloaded.fid.name)
 
+    @pytest.mark.skipif(IS_PYPY, reason="Hangs on PyPy")
     @pytest.mark.skipif(not IS_64BIT, reason="Needs 64bit platform")
     @pytest.mark.slow
     def test_big_arrays(self):
@@ -779,6 +780,8 @@ class TestLoadTxt(LoadTxtBase):
         a = np.array([[1, 2, 3], [4, 5, 6]], int)
         assert_array_equal(x, a)
 
+    @pytest.mark.skipif(IS_PYPY and sys.implementation.version <= (7, 3, 8),
+                        reason="PyPy bug in error formatting")
     def test_comments_multi_chars(self):
         c = TextIO()
         c.write('/* comment\n1,2,3,5\n')
@@ -984,6 +987,8 @@ class TestLoadTxt(LoadTxtBase):
             res = np.loadtxt(c, dtype=dt)
             assert_equal(res, tgt, err_msg="%s" % dt)
 
+    @pytest.mark.skipif(IS_PYPY and sys.implementation.version <= (7, 3, 8),
+                        reason="PyPy bug in error formatting")
     def test_default_float_converter_no_default_hex_conversion(self):
         """
         Ensure that fromhex is only used for values with the correct prefix and
@@ -995,6 +1000,8 @@ class TestLoadTxt(LoadTxtBase):
         ):
             np.loadtxt(c)
 
+    @pytest.mark.skipif(IS_PYPY and sys.implementation.version <= (7, 3, 8),
+                        reason="PyPy bug in error formatting")
     def test_default_float_converter_exception(self):
         """
         Ensure that the exception message raised during failed floating point
index 94536bb2c05572e95706fd1e20099e4f2ccfb08a..73c386f1ccbfd833fd08bf9ddf7ea479e81419ea 100644 (file)
@@ -3,6 +3,7 @@ import sys
 
 def configuration(parent_package='', top_path=None):
     from numpy.distutils.misc_util import Configuration
+    from numpy.distutils.ccompiler_opt import NPY_CXX_FLAGS
     from numpy.distutils.system_info import get_info, system_info
     config = Configuration('linalg', parent_package, top_path)
 
@@ -72,6 +73,7 @@ def configuration(parent_package='', top_path=None):
         sources=['umath_linalg.c.src', get_lapack_lite_sources],
         depends=['lapack_lite/f2c.h'],
         extra_info=lapack_info,
+        extra_cxx_compile_args=NPY_CXX_FLAGS,
         libraries=['npymath'],
     )
     config.add_data_files('*.pyi')
index d5cfbf5acc45b9c9d4efb53eaf599c73325b4875..a7e4fa5e6eb923ac8cca835a597ee181e88887f0 100644 (file)
@@ -254,122 +254,127 @@ class _8Bit(_16Bit):  # type: ignore[misc]
     pass
 
 
-from ._nested_sequence import _NestedSequence
+from ._nested_sequence import (
+    _NestedSequence as _NestedSequence,
+)
 from ._nbit import (
-    _NBitByte,
-    _NBitShort,
-    _NBitIntC,
-    _NBitIntP,
-    _NBitInt,
-    _NBitLongLong,
-    _NBitHalf,
-    _NBitSingle,
-    _NBitDouble,
-    _NBitLongDouble,
+    _NBitByte as _NBitByte,
+    _NBitShort as _NBitShort,
+    _NBitIntC as _NBitIntC,
+    _NBitIntP as _NBitIntP,
+    _NBitInt as _NBitInt,
+    _NBitLongLong as _NBitLongLong,
+    _NBitHalf as _NBitHalf,
+    _NBitSingle as _NBitSingle,
+    _NBitDouble as _NBitDouble,
+    _NBitLongDouble as _NBitLongDouble,
 )
 from ._char_codes import (
-    _BoolCodes,
-    _UInt8Codes,
-    _UInt16Codes,
-    _UInt32Codes,
-    _UInt64Codes,
-    _Int8Codes,
-    _Int16Codes,
-    _Int32Codes,
-    _Int64Codes,
-    _Float16Codes,
-    _Float32Codes,
-    _Float64Codes,
-    _Complex64Codes,
-    _Complex128Codes,
-    _ByteCodes,
-    _ShortCodes,
-    _IntCCodes,
-    _IntPCodes,
-    _IntCodes,
-    _LongLongCodes,
-    _UByteCodes,
-    _UShortCodes,
-    _UIntCCodes,
-    _UIntPCodes,
-    _UIntCodes,
-    _ULongLongCodes,
-    _HalfCodes,
-    _SingleCodes,
-    _DoubleCodes,
-    _LongDoubleCodes,
-    _CSingleCodes,
-    _CDoubleCodes,
-    _CLongDoubleCodes,
-    _DT64Codes,
-    _TD64Codes,
-    _StrCodes,
-    _BytesCodes,
-    _VoidCodes,
-    _ObjectCodes,
+    _BoolCodes as _BoolCodes,
+    _UInt8Codes as _UInt8Codes,
+    _UInt16Codes as _UInt16Codes,
+    _UInt32Codes as _UInt32Codes,
+    _UInt64Codes as _UInt64Codes,
+    _Int8Codes as _Int8Codes,
+    _Int16Codes as _Int16Codes,
+    _Int32Codes as _Int32Codes,
+    _Int64Codes as _Int64Codes,
+    _Float16Codes as _Float16Codes,
+    _Float32Codes as _Float32Codes,
+    _Float64Codes as _Float64Codes,
+    _Complex64Codes as _Complex64Codes,
+    _Complex128Codes as _Complex128Codes,
+    _ByteCodes as _ByteCodes,
+    _ShortCodes as _ShortCodes,
+    _IntCCodes as _IntCCodes,
+    _IntPCodes as _IntPCodes,
+    _IntCodes as _IntCodes,
+    _LongLongCodes as _LongLongCodes,
+    _UByteCodes as _UByteCodes,
+    _UShortCodes as _UShortCodes,
+    _UIntCCodes as _UIntCCodes,
+    _UIntPCodes as _UIntPCodes,
+    _UIntCodes as _UIntCodes,
+    _ULongLongCodes as _ULongLongCodes,
+    _HalfCodes as _HalfCodes,
+    _SingleCodes as _SingleCodes,
+    _DoubleCodes as _DoubleCodes,
+    _LongDoubleCodes as _LongDoubleCodes,
+    _CSingleCodes as _CSingleCodes,
+    _CDoubleCodes as _CDoubleCodes,
+    _CLongDoubleCodes as _CLongDoubleCodes,
+    _DT64Codes as _DT64Codes,
+    _TD64Codes as _TD64Codes,
+    _StrCodes as _StrCodes,
+    _BytesCodes as _BytesCodes,
+    _VoidCodes as _VoidCodes,
+    _ObjectCodes as _ObjectCodes,
 )
 from ._scalars import (
-    _CharLike_co,
-    _BoolLike_co,
-    _UIntLike_co,
-    _IntLike_co,
-    _FloatLike_co,
-    _ComplexLike_co,
-    _TD64Like_co,
-    _NumberLike_co,
-    _ScalarLike_co,
-    _VoidLike_co,
+    _CharLike_co as _CharLike_co,
+    _BoolLike_co as _BoolLike_co,
+    _UIntLike_co as _UIntLike_co,
+    _IntLike_co as _IntLike_co,
+    _FloatLike_co as _FloatLike_co,
+    _ComplexLike_co as _ComplexLike_co,
+    _TD64Like_co as _TD64Like_co,
+    _NumberLike_co as _NumberLike_co,
+    _ScalarLike_co as _ScalarLike_co,
+    _VoidLike_co as _VoidLike_co,
+)
+from ._shape import (
+    _Shape as _Shape,
+    _ShapeLike as _ShapeLike,
 )
-from ._shape import _Shape, _ShapeLike
 from ._dtype_like import (
     DTypeLike as DTypeLike,
-    _SupportsDType,
-    _VoidDTypeLike,
-    _DTypeLikeBool,
-    _DTypeLikeUInt,
-    _DTypeLikeInt,
-    _DTypeLikeFloat,
-    _DTypeLikeComplex,
-    _DTypeLikeTD64,
-    _DTypeLikeDT64,
-    _DTypeLikeObject,
-    _DTypeLikeVoid,
-    _DTypeLikeStr,
-    _DTypeLikeBytes,
-    _DTypeLikeComplex_co,
+    _SupportsDType as _SupportsDType,
+    _VoidDTypeLike as _VoidDTypeLike,
+    _DTypeLikeBool as _DTypeLikeBool,
+    _DTypeLikeUInt as _DTypeLikeUInt,
+    _DTypeLikeInt as _DTypeLikeInt,
+    _DTypeLikeFloat as _DTypeLikeFloat,
+    _DTypeLikeComplex as _DTypeLikeComplex,
+    _DTypeLikeTD64 as _DTypeLikeTD64,
+    _DTypeLikeDT64 as _DTypeLikeDT64,
+    _DTypeLikeObject as _DTypeLikeObject,
+    _DTypeLikeVoid as _DTypeLikeVoid,
+    _DTypeLikeStr as _DTypeLikeStr,
+    _DTypeLikeBytes as _DTypeLikeBytes,
+    _DTypeLikeComplex_co as _DTypeLikeComplex_co,
 )
 from ._array_like import (
     ArrayLike as ArrayLike,
-    _ArrayLike,
-    _FiniteNestedSequence,
-    _SupportsArray,
-    _ArrayLikeInt,
-    _ArrayLikeBool_co,
-    _ArrayLikeUInt_co,
-    _ArrayLikeInt_co,
-    _ArrayLikeFloat_co,
-    _ArrayLikeComplex_co,
-    _ArrayLikeNumber_co,
-    _ArrayLikeTD64_co,
-    _ArrayLikeDT64_co,
-    _ArrayLikeObject_co,
-    _ArrayLikeVoid_co,
-    _ArrayLikeStr_co,
-    _ArrayLikeBytes_co,
+    _ArrayLike as _ArrayLike,
+    _FiniteNestedSequence as _FiniteNestedSequence,
+    _SupportsArray as _SupportsArray,
+    _ArrayLikeInt as _ArrayLikeInt,
+    _ArrayLikeBool_co as _ArrayLikeBool_co,
+    _ArrayLikeUInt_co as _ArrayLikeUInt_co,
+    _ArrayLikeInt_co as _ArrayLikeInt_co,
+    _ArrayLikeFloat_co as _ArrayLikeFloat_co,
+    _ArrayLikeComplex_co as _ArrayLikeComplex_co,
+    _ArrayLikeNumber_co as _ArrayLikeNumber_co,
+    _ArrayLikeTD64_co as _ArrayLikeTD64_co,
+    _ArrayLikeDT64_co as _ArrayLikeDT64_co,
+    _ArrayLikeObject_co as _ArrayLikeObject_co,
+    _ArrayLikeVoid_co as _ArrayLikeVoid_co,
+    _ArrayLikeStr_co as _ArrayLikeStr_co,
+    _ArrayLikeBytes_co as _ArrayLikeBytes_co,
 )
 from ._generic_alias import (
     NDArray as NDArray,
-    _DType,
-    _GenericAlias,
+    _DType as _DType,
+    _GenericAlias as _GenericAlias,
 )
 
 if TYPE_CHECKING:
     from ._ufunc import (
-        _UFunc_Nin1_Nout1,
-        _UFunc_Nin2_Nout1,
-        _UFunc_Nin1_Nout2,
-        _UFunc_Nin2_Nout2,
-        _GUFunc_Nin2_Nout1,
+        _UFunc_Nin1_Nout1 as _UFunc_Nin1_Nout1,
+        _UFunc_Nin2_Nout1 as _UFunc_Nin2_Nout1,
+        _UFunc_Nin1_Nout2 as _UFunc_Nin1_Nout2,
+        _UFunc_Nin2_Nout2 as _UFunc_Nin2_Nout2,
+        _GUFunc_Nin2_Nout1 as _GUFunc_Nin2_Nout1,
     )
 else:
     # Declare the (type-check-only) ufunc subclasses as ufunc aliases during
index 548f762612fca628eccaeed66d1f3bd95d47dd0f..baad759bbdc3530a489e87f404f814f5f95240be 100644 (file)
@@ -1,6 +1,7 @@
 [mypy]
 plugins = numpy.typing.mypy_plugin
 show_absolute_path = True
+implicit_reexport = False
 
 [mypy-numpy]
 ignore_errors = True
index 6df1c7c294af8f55305fcf2bf9ba5848155d313d..265690a4df42699220b6edd6c7104bceaf82b962 100644 (file)
@@ -153,7 +153,7 @@ reveal_type(np.full(1, i8, dtype=np.float64))  # E: ndarray[Any, dtype[{float64}
 reveal_type(np.full(1, i8, dtype=float))  # E: ndarray[Any, dtype[Any]]
 
 reveal_type(np.indices([1, 2, 3]))  # E: ndarray[Any, dtype[{int_}]]
-reveal_type(np.indices([1, 2, 3], sparse=True))  # E: tuple[ndarray[Any, dtype[{int_}]]]
+reveal_type(np.indices([1, 2, 3], sparse=True))  # E: tuple[ndarray[Any, dtype[{int_}]], ...]
 
 reveal_type(np.fromfunction(func, (3, 5)))  # E: SubClass[{float64}]
 
index 2dab9d08c7fa7fc154968eee4e075da3eb3ada5f..b6c26ddb70e1168b288156ec94eaca9088aec028 100644 (file)
@@ -9,7 +9,7 @@ reveal_type(ar_iter.buf_size)  # E: Union[None, builtins.int]
 reveal_type(ar_iter.start)  # E: builtins.list[builtins.int]
 reveal_type(ar_iter.stop)  # E: builtins.list[builtins.int]
 reveal_type(ar_iter.step)  # E: builtins.list[builtins.int]
-reveal_type(ar_iter.shape)  # E: builtins.tuple[builtins.int]
+reveal_type(ar_iter.shape)  # E: builtins.tuple[builtins.int, ...]
 reveal_type(ar_iter.flat)  # E: typing.Generator[{int64}, None, None]
 
 reveal_type(ar_iter.__array__())  # E: ndarray[Any, dtype[{int64}]]
index 934d7da5efe2fc4544f803e165bb2751339b501b..7a658511a0198f09eef28bdc73f4127a9760c558 100644 (file)
@@ -48,11 +48,11 @@ reveal_type(np.dtype(("U", 10)))  # E: dtype[void]
 
 # Methods and attributes
 reveal_type(dtype_U.base)  # E: dtype[Any]
-reveal_type(dtype_U.subdtype)  # E: Union[None, Tuple[dtype[Any], builtins.tuple[builtins.int]]]
+reveal_type(dtype_U.subdtype)  # E: Union[None, Tuple[dtype[Any], builtins.tuple[builtins.int, ...]]]
 reveal_type(dtype_U.newbyteorder())  # E: dtype[str_]
 reveal_type(dtype_U.type)  # E: Type[str_]
 reveal_type(dtype_U.name)  # E: str
-reveal_type(dtype_U.names)  # E: Union[None, builtins.tuple[builtins.str]]
+reveal_type(dtype_U.names)  # E: Union[None, builtins.tuple[builtins.str, ...]]
 
 reveal_type(dtype_U * 0)  # E: dtype[str_]
 reveal_type(dtype_U * 1)  # E: dtype[str_]
index 9e7d6e5452d12d1bd6c0f0524426ca2597e83b18..0f0758175a53f55991d0b0b323a5f0311fb5378c 100644 (file)
@@ -5,9 +5,9 @@ a: np.flatiter[np.ndarray[Any, np.dtype[np.str_]]]
 
 reveal_type(a.base)  # E: ndarray[Any, dtype[str_]]
 reveal_type(a.copy())  # E: ndarray[Any, dtype[str_]]
-reveal_type(a.coords)  # E: tuple[builtins.int]
+reveal_type(a.coords)  # E: tuple[builtins.int, ...]
 reveal_type(a.index)  # E: int
-reveal_type(iter(a))  # E: Iterator[str_]
+reveal_type(iter(a))  # E: flatiter[ndarray[Any, dtype[str_]]]
 reveal_type(next(a))  # E: str_
 reveal_type(a[0])  # E: str_
 reveal_type(a[[0, 1, 2]])  # E: ndarray[Any, dtype[str_]]
index 2ee1952cf7bf4f2b24b4ea5b4515ad6bd8634c04..cbd8d65b9f73f288d8711e07512195002c19e953 100644 (file)
@@ -103,17 +103,17 @@ reveal_type(np.ravel(c))  # E: ndarray[Any, Any]
 reveal_type(np.ravel(A))  # E: ndarray[Any, Any]
 reveal_type(np.ravel(B))  # E: ndarray[Any, Any]
 
-reveal_type(np.nonzero(a))  # E: tuple[ndarray[Any, Any]]
-reveal_type(np.nonzero(b))  # E: tuple[ndarray[Any, Any]]
-reveal_type(np.nonzero(c))  # E: tuple[ndarray[Any, Any]]
-reveal_type(np.nonzero(A))  # E: tuple[ndarray[Any, Any]]
-reveal_type(np.nonzero(B))  # E: tuple[ndarray[Any, Any]]
-
-reveal_type(np.shape(a))  # E: tuple[builtins.int]
-reveal_type(np.shape(b))  # E: tuple[builtins.int]
-reveal_type(np.shape(c))  # E: tuple[builtins.int]
-reveal_type(np.shape(A))  # E: tuple[builtins.int]
-reveal_type(np.shape(B))  # E: tuple[builtins.int]
+reveal_type(np.nonzero(a))  # E: tuple[ndarray[Any, Any], ...]
+reveal_type(np.nonzero(b))  # E: tuple[ndarray[Any, Any], ...]
+reveal_type(np.nonzero(c))  # E: tuple[ndarray[Any, Any], ...]
+reveal_type(np.nonzero(A))  # E: tuple[ndarray[Any, Any], ...]
+reveal_type(np.nonzero(B))  # E: tuple[ndarray[Any, Any], ...]
+
+reveal_type(np.shape(a))  # E: tuple[builtins.int, ...]
+reveal_type(np.shape(b))  # E: tuple[builtins.int, ...]
+reveal_type(np.shape(c))  # E: tuple[builtins.int, ...]
+reveal_type(np.shape(A))  # E: tuple[builtins.int, ...]
+reveal_type(np.shape(B))  # E: tuple[builtins.int, ...]
 
 reveal_type(np.compress([True], a))  # E: ndarray[Any, Any]
 reveal_type(np.compress([True], b))  # E: ndarray[Any, Any]
index 55c033fe011fd343ec5475dc3edff19cc050e278..a41431025ced4e3d281d2b91fb62fecda42d93cb 100644 (file)
@@ -16,22 +16,22 @@ reveal_type(np.ndenumerate(AR_i8).iter)  # E: flatiter[ndarray[Any, dtype[{int64
 reveal_type(np.ndenumerate(AR_LIKE_f).iter)  # E: flatiter[ndarray[Any, dtype[{double}]]]
 reveal_type(np.ndenumerate(AR_LIKE_U).iter)  # E: flatiter[ndarray[Any, dtype[str_]]]
 
-reveal_type(next(np.ndenumerate(AR_i8)))  # E: Tuple[builtins.tuple[builtins.int], {int64}]
-reveal_type(next(np.ndenumerate(AR_LIKE_f)))  # E: Tuple[builtins.tuple[builtins.int], {double}]
-reveal_type(next(np.ndenumerate(AR_LIKE_U)))  # E: Tuple[builtins.tuple[builtins.int], str_]
+reveal_type(next(np.ndenumerate(AR_i8)))  # E: Tuple[builtins.tuple[builtins.int, ...], {int64}]
+reveal_type(next(np.ndenumerate(AR_LIKE_f)))  # E: Tuple[builtins.tuple[builtins.int, ...], {double}]
+reveal_type(next(np.ndenumerate(AR_LIKE_U)))  # E: Tuple[builtins.tuple[builtins.int, ...], str_]
 
-reveal_type(iter(np.ndenumerate(AR_i8)))  # E: Iterator[Tuple[builtins.tuple[builtins.int], {int64}]]
-reveal_type(iter(np.ndenumerate(AR_LIKE_f)))  # E: Iterator[Tuple[builtins.tuple[builtins.int], {double}]]
-reveal_type(iter(np.ndenumerate(AR_LIKE_U)))  # E: Iterator[Tuple[builtins.tuple[builtins.int], str_]]
+reveal_type(iter(np.ndenumerate(AR_i8)))  # E: ndenumerate[{int64}]
+reveal_type(iter(np.ndenumerate(AR_LIKE_f)))  # E: ndenumerate[{double}]
+reveal_type(iter(np.ndenumerate(AR_LIKE_U)))  # E: ndenumerate[str_]
 
 reveal_type(np.ndindex(1, 2, 3))  # E: numpy.ndindex
 reveal_type(np.ndindex((1, 2, 3)))  # E: numpy.ndindex
-reveal_type(iter(np.ndindex(1, 2, 3)))  # E: Iterator[builtins.tuple[builtins.int]]
-reveal_type(next(np.ndindex(1, 2, 3)))  # E: builtins.tuple[builtins.int]
+reveal_type(iter(np.ndindex(1, 2, 3)))  # E: ndindex
+reveal_type(next(np.ndindex(1, 2, 3)))  # E: builtins.tuple[builtins.int, ...]
 
-reveal_type(np.unravel_index([22, 41, 37], (7, 6)))  # E: tuple[ndarray[Any, dtype[{intp}]]]
-reveal_type(np.unravel_index([31, 41, 13], (7, 6), order="F"))  # E: tuple[ndarray[Any, dtype[{intp}]]]
-reveal_type(np.unravel_index(1621, (6, 7, 8, 9)))  # E: tuple[{intp}]
+reveal_type(np.unravel_index([22, 41, 37], (7, 6)))  # E: tuple[ndarray[Any, dtype[{intp}]], ...]
+reveal_type(np.unravel_index([31, 41, 13], (7, 6), order="F"))  # E: tuple[ndarray[Any, dtype[{intp}]], ...]
+reveal_type(np.unravel_index(1621, (6, 7, 8, 9)))  # E: tuple[{intp}, ...]
 
 reveal_type(np.ravel_multi_index([[1]], (7, 6)))  # E: ndarray[Any, dtype[{intp}]]
 reveal_type(np.ravel_multi_index(AR_LIKE_i, (7, 6)))  # E: {intp}
@@ -54,13 +54,13 @@ reveal_type(np.s_[0:1])  # E: builtins.slice
 reveal_type(np.s_[0:1, None:3])  # E: Tuple[builtins.slice, builtins.slice]
 reveal_type(np.s_[0, 0:1, ..., [0, 1, 3]])  # E: Tuple[Literal[0]?, builtins.slice, builtins.ellipsis, builtins.list[builtins.int]]
 
-reveal_type(np.ix_(AR_LIKE_b))  # E: tuple[ndarray[Any, dtype[bool_]]]
-reveal_type(np.ix_(AR_LIKE_i, AR_LIKE_f))  # E: tuple[ndarray[Any, dtype[{double}]]]
-reveal_type(np.ix_(AR_i8))  # E: tuple[ndarray[Any, dtype[{int64}]]]
+reveal_type(np.ix_(AR_LIKE_b))  # E: tuple[ndarray[Any, dtype[bool_]], ...]
+reveal_type(np.ix_(AR_LIKE_i, AR_LIKE_f))  # E: tuple[ndarray[Any, dtype[{double}]], ...]
+reveal_type(np.ix_(AR_i8))  # E: tuple[ndarray[Any, dtype[{int64}]], ...]
 
 reveal_type(np.fill_diagonal(AR_i8, 5))  # E: None
 
-reveal_type(np.diag_indices(4))  # E: tuple[ndarray[Any, dtype[{int_}]]]
-reveal_type(np.diag_indices(2, 3))  # E: tuple[ndarray[Any, dtype[{int_}]]]
+reveal_type(np.diag_indices(4))  # E: tuple[ndarray[Any, dtype[{int_}]], ...]
+reveal_type(np.diag_indices(2, 3))  # E: tuple[ndarray[Any, dtype[{int_}]], ...]
 
-reveal_type(np.diag_indices_from(AR_i8))  # E: tuple[ndarray[Any, dtype[{int_}]]]
+reveal_type(np.diag_indices_from(AR_i8))  # E: tuple[ndarray[Any, dtype[{int_}]], ...]
index 56706d8d6f91eda0cee5ac0e058cc30a6e3439f4..72fb887742b8d95512ba6342728ea4d59afd29e9 100644 (file)
@@ -34,29 +34,29 @@ timedelta_seq: list[dt.timedelta]
 
 def func(a: int) -> bool: ...
 
-reveal_type(next(b_f8))  # E: tuple[Any]
+reveal_type(next(b_f8))  # E: tuple[Any, ...]
 reveal_type(b_f8.reset())  # E: None
 reveal_type(b_f8.index)  # E: int
-reveal_type(b_f8.iters)  # E: tuple[flatiter[Any]]
+reveal_type(b_f8.iters)  # E: tuple[flatiter[Any], ...]
 reveal_type(b_f8.nd)  # E: int
 reveal_type(b_f8.ndim)  # E: int
 reveal_type(b_f8.numiter)  # E: int
-reveal_type(b_f8.shape)  # E: tuple[builtins.int]
+reveal_type(b_f8.shape)  # E: tuple[builtins.int, ...]
 reveal_type(b_f8.size)  # E: int
 
-reveal_type(next(b_i8_f8_f8))  # E: tuple[Any]
+reveal_type(next(b_i8_f8_f8))  # E: tuple[Any, ...]
 reveal_type(b_i8_f8_f8.reset())  # E: None
 reveal_type(b_i8_f8_f8.index)  # E: int
-reveal_type(b_i8_f8_f8.iters)  # E: tuple[flatiter[Any]]
+reveal_type(b_i8_f8_f8.iters)  # E: tuple[flatiter[Any], ...]
 reveal_type(b_i8_f8_f8.nd)  # E: int
 reveal_type(b_i8_f8_f8.ndim)  # E: int
 reveal_type(b_i8_f8_f8.numiter)  # E: int
-reveal_type(b_i8_f8_f8.shape)  # E: tuple[builtins.int]
+reveal_type(b_i8_f8_f8.shape)  # E: tuple[builtins.int, ...]
 reveal_type(b_i8_f8_f8.size)  # E: int
 
 reveal_type(np.inner(AR_f8, AR_i8))  # E: Any
 
-reveal_type(np.where([True, True, False]))  # E: tuple[ndarray[Any, dtype[{intp}]]]
+reveal_type(np.where([True, True, False]))  # E: tuple[ndarray[Any, dtype[{intp}]], ...]
 reveal_type(np.where([True, True, False], 1, 0))  # E: ndarray[Any, dtype[Any]]
 
 reveal_type(np.lexsort([0, 1, 2]))  # E: Any
@@ -138,7 +138,7 @@ reveal_type(np.compare_chararrays(b"a", b"a", "==", True))  # E: ndarray[Any, dt
 
 reveal_type(np.add_docstring(func, "test"))  # E: None
 
-reveal_type(np.nested_iters([AR_i8, AR_i8], [[0], [1]], flags=["c_index"]))  # E: tuple[nditer]
-reveal_type(np.nested_iters([AR_i8, AR_i8], [[0], [1]], op_flags=[["readonly", "readonly"]]))  # E: tuple[nditer]
-reveal_type(np.nested_iters([AR_i8, AR_i8], [[0], [1]], op_dtypes=np.int_))  # E: tuple[nditer]
-reveal_type(np.nested_iters([AR_i8, AR_i8], [[0], [1]], order="C", casting="no"))  # E: tuple[nditer]
+reveal_type(np.nested_iters([AR_i8, AR_i8], [[0], [1]], flags=["c_index"]))  # E: tuple[nditer, ...]
+reveal_type(np.nested_iters([AR_i8, AR_i8], [[0], [1]], op_flags=[["readonly", "readonly"]]))  # E: tuple[nditer, ...]
+reveal_type(np.nested_iters([AR_i8, AR_i8], [[0], [1]], op_dtypes=np.int_))  # E: tuple[nditer, ...]
+reveal_type(np.nested_iters([AR_i8, AR_i8], [[0], [1]], order="C", casting="no"))  # E: tuple[nditer, ...]
index f91d6351b9c8cb993c62909bccb9b6d99c540ce9..da4da3dcfcb43486c46727414b54473bd9cdb22d 100644 (file)
@@ -165,7 +165,7 @@ reveal_type(AR_f8.dot(1))  # E: ndarray[Any, Any]
 reveal_type(AR_f8.dot([1]))  # E: Any
 reveal_type(AR_f8.dot(1, out=B))  # E: SubClass
 
-reveal_type(AR_f8.nonzero())  # E: tuple[ndarray[Any, dtype[{intp}]]]
+reveal_type(AR_f8.nonzero())  # E: tuple[ndarray[Any, dtype[{intp}]], ...]
 
 reveal_type(AR_f8.searchsorted(1))  # E: {intp}
 reveal_type(AR_f8.searchsorted([1]))  # E: ndarray[Any, dtype[{intp}]]
index 65861da54c1638cb262f707ce5fb1555b068ebd7..fd8b7e1094fcbbf619f3df393ee12a3d3f030581 100644 (file)
@@ -7,7 +7,7 @@ reveal_type(np.nditer([0, 1], op_flags=[["readonly", "readonly"]]))  # E: nditer
 reveal_type(np.nditer([0, 1], op_dtypes=np.int_))  # E: nditer
 reveal_type(np.nditer([0, 1], order="C", casting="no"))  # E: nditer
 
-reveal_type(nditer_obj.dtypes)  # E: tuple[dtype[Any]]
+reveal_type(nditer_obj.dtypes)  # E: tuple[dtype[Any], ...]
 reveal_type(nditer_obj.finished)  # E: bool
 reveal_type(nditer_obj.has_delayed_bufalloc)  # E: bool
 reveal_type(nditer_obj.has_index)  # E: bool
@@ -15,15 +15,15 @@ reveal_type(nditer_obj.has_multi_index)  # E: bool
 reveal_type(nditer_obj.index)  # E: int
 reveal_type(nditer_obj.iterationneedsapi)  # E: bool
 reveal_type(nditer_obj.iterindex)  # E: int
-reveal_type(nditer_obj.iterrange)  # E: tuple[builtins.int]
+reveal_type(nditer_obj.iterrange)  # E: tuple[builtins.int, ...]
 reveal_type(nditer_obj.itersize)  # E: int
-reveal_type(nditer_obj.itviews)  # E: tuple[ndarray[Any, dtype[Any]]]
-reveal_type(nditer_obj.multi_index)  # E: tuple[builtins.int]
+reveal_type(nditer_obj.itviews)  # E: tuple[ndarray[Any, dtype[Any]], ...]
+reveal_type(nditer_obj.multi_index)  # E: tuple[builtins.int, ...]
 reveal_type(nditer_obj.ndim)  # E: int
 reveal_type(nditer_obj.nop)  # E: int
-reveal_type(nditer_obj.operands)  # E: tuple[ndarray[Any, dtype[Any]]]
-reveal_type(nditer_obj.shape)  # E: tuple[builtins.int]
-reveal_type(nditer_obj.value)  # E: tuple[ndarray[Any, dtype[Any]]]
+reveal_type(nditer_obj.operands)  # E: tuple[ndarray[Any, dtype[Any]], ...]
+reveal_type(nditer_obj.shape)  # E: tuple[builtins.int, ...]
+reveal_type(nditer_obj.value)  # E: tuple[ndarray[Any, dtype[Any]], ...]
 
 reveal_type(nditer_obj.close())  # E: None
 reveal_type(nditer_obj.copy())  # E: nditer
@@ -35,12 +35,12 @@ reveal_type(nditer_obj.remove_multi_index())  # E: None
 reveal_type(nditer_obj.reset())  # E: None
 
 reveal_type(len(nditer_obj))  # E: int
-reveal_type(iter(nditer_obj))  # E: Iterator[builtins.tuple[ndarray[Any, dtype[Any]]]]
-reveal_type(next(nditer_obj))  # E: tuple[ndarray[Any, dtype[Any]]]
+reveal_type(iter(nditer_obj))  # E: nditer
+reveal_type(next(nditer_obj))  # E: tuple[ndarray[Any, dtype[Any]], ...]
 reveal_type(nditer_obj.__copy__())  # E: nditer
 with nditer_obj as f:
     reveal_type(f)  # E: nditer
 reveal_type(nditer_obj[0])  # E: ndarray[Any, dtype[Any]]
-reveal_type(nditer_obj[:])  # E: tuple[ndarray[Any, dtype[Any]]]
+reveal_type(nditer_obj[:])  # E: tuple[ndarray[Any, dtype[Any]], ...]
 nditer_obj[0] = 0
 nditer_obj[:] = [0, 1]
index bf5653937c196c695150ed9fe84f7c8378ce6638..e9a884c7c339cfacd286c14a54fc327af11d971c 100644 (file)
@@ -106,11 +106,11 @@ reveal_type(np.cross(AR_i8, AR_c16))  # E: ndarray[Any, dtype[complexfloating[An
 reveal_type(np.cross(AR_O, AR_O))  # E: ndarray[Any, dtype[object_]]
 
 reveal_type(np.indices([0, 1, 2]))  # E: ndarray[Any, dtype[{int_}]]
-reveal_type(np.indices([0, 1, 2], sparse=True))  # E: tuple[ndarray[Any, dtype[{int_}]]]
+reveal_type(np.indices([0, 1, 2], sparse=True))  # E: tuple[ndarray[Any, dtype[{int_}]], ...]
 reveal_type(np.indices([0, 1, 2], dtype=np.float64))  # E: ndarray[Any, dtype[{float64}]]
-reveal_type(np.indices([0, 1, 2], sparse=True, dtype=np.float64))  # E: tuple[ndarray[Any, dtype[{float64}]]]
+reveal_type(np.indices([0, 1, 2], sparse=True, dtype=np.float64))  # E: tuple[ndarray[Any, dtype[{float64}]], ...]
 reveal_type(np.indices([0, 1, 2], dtype=float))  # E: ndarray[Any, dtype[Any]]
-reveal_type(np.indices([0, 1, 2], sparse=True, dtype=float))  # E: tuple[ndarray[Any, dtype[Any]]]
+reveal_type(np.indices([0, 1, 2], sparse=True, dtype=float))  # E: tuple[ndarray[Any, dtype[Any]], ...]
 
 reveal_type(np.binary_repr(1))  # E: str
 
index 0d6dcd388e68fea42f8110bfa948862bdebf6811..207cb34088e61b8cfee52a9f01d05976fb592aa1 100644 (file)
@@ -21,8 +21,8 @@ reveal_type(np.broadcast_to(AR_f8, 5))  # E: ndarray[Any, dtype[{float64}]]
 reveal_type(np.broadcast_to(AR_LIKE_f, (1, 5)))  # E: ndarray[Any, dtype[Any]]
 reveal_type(np.broadcast_to(AR_f8, [4, 6], subok=True))  # E: ndarray[Any, dtype[{float64}]]
 
-reveal_type(np.broadcast_shapes((1, 2), [3, 1], (3, 2)))  # E: tuple[builtins.int]
-reveal_type(np.broadcast_shapes((6, 7), (5, 6, 1), 7, (5, 1, 7)))  # E: tuple[builtins.int]
+reveal_type(np.broadcast_shapes((1, 2), [3, 1], (3, 2)))  # E: tuple[builtins.int, ...]
+reveal_type(np.broadcast_shapes((6, 7), (5, 6, 1), 7, (5, 1, 7)))  # E: tuple[builtins.int, ...]
 
 reveal_type(np.broadcast_arrays(AR_f8, AR_f8))  # E: list[ndarray[Any, dtype[Any]]]
 reveal_type(np.broadcast_arrays(AR_f8, AR_LIKE_f))  # E: list[ndarray[Any, dtype[Any]]]
index 9813dc723fa3b2a7ad1d58e60829cadb189c0363..47cb1d04740610c14d17d5bf5fb2c04618854f32 100644 (file)
@@ -29,7 +29,7 @@ reveal_type(np.testing.clear_and_catch_warnings(modules=[np.testing]))  # E: _cl
 reveal_type(np.testing.clear_and_catch_warnings(True))  # E: _clear_and_catch_warnings_with_records
 reveal_type(np.testing.clear_and_catch_warnings(False))  # E: _clear_and_catch_warnings_without_records
 reveal_type(np.testing.clear_and_catch_warnings(bool_obj))  # E: clear_and_catch_warnings
-reveal_type(np.testing.clear_and_catch_warnings.class_modules)  # E: tuple[types.ModuleType]
+reveal_type(np.testing.clear_and_catch_warnings.class_modules)  # E: tuple[types.ModuleType, ...]
 reveal_type(np.testing.clear_and_catch_warnings.modules)  # E: set[types.ModuleType]
 
 with np.testing.clear_and_catch_warnings(True) as c1:
index 1413cb8bc8535b927885fa3772a924e0ecf5acfa..05f775d44876f78df446fe5b27e70a94f9e6fbf2 100644 (file)
@@ -38,7 +38,7 @@ from paver.easy import Bunch, options, task, sh
 #-----------------------------------
 
 # Path to the release notes
-RELEASE_NOTES = 'doc/source/release/1.22.3-notes.rst'
+RELEASE_NOTES = 'doc/source/release/1.22.4-notes.rst'
 
 
 #-------------------------------------------------------
index 39d6fcd98a2667380f36aa5b810c0327a7248fde..de54171996543d063ca94d449e69d3d6aa995202 100644 (file)
@@ -4,7 +4,7 @@ requires = [
     "packaging==20.5; platform_machine=='arm64'",  # macos M1
     "setuptools==59.2.0",
     "wheel==0.37.0",
-    "Cython>=0.29.24,<3.0",  # Note: keep in sync with tools/cythonize.py
+    "Cython>=0.29.30,<3.0",  # Note: keep in sync with tools/cythonize.py
 ]
 
 
index e33649c4a37f66a35b622f9e51350309026c9a00..0bc83e2daf91adb25d02f6061046092bf1aa62f4 100644 (file)
@@ -1,4 +1,4 @@
-cython==0.29.24
+cython==0.29.30
 wheel==0.37.0
 setuptools==59.2.0
 hypothesis==6.24.1
@@ -9,4 +9,5 @@ pytest-cov==3.0.0
 cffi; python_version < '3.10'
 # For testing types. Notes on the restrictions:
 # - Mypy relies on C API features not present in PyPy
-mypy==0.930; platform_python_implementation != "PyPy"
+# NOTE: Keep mypy in sync with environment.yml
+mypy==0.940; platform_python_implementation != "PyPy"
index c06962cf98a96d7eefe48ba628a3b44e95a5e015..f7b179574c99e4860a59006f56f7cc499040cc7b 100755 (executable)
@@ -67,7 +67,7 @@ def process_pyx(fromfile, tofile):
         # Python versions.
         # Note: keep in sync with that in pyproject.toml
         # Update for Python 3.10
-        required_version = LooseVersion('0.29.24')
+        required_version = LooseVersion('0.29.30')
 
         if LooseVersion(cython_version) < required_version:
             cython_path = Cython.__file__