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.
--- /dev/null
+
+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.
--- /dev/null
+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.
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;
+}
+++ /dev/null
-{% 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 %}
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
User Guide <user/index>
API reference <reference/index>
Development <dev/index>
+ release
**Version**: |version|
.. 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
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
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
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
.. 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>
--- /dev/null
+.. 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.
+
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.
# 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
channels:
- conda-forge
dependencies:
- - python
- - cython
+ - python=3.9 #need to pin to avoid issues with builds
+ - cython=0.29.30
- compilers
- openblas
- nomkl
- 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
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
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'
--- /dev/null
+#pragma GCC diagnostic ignored "-Wnonnull"
+long double strtold_l(const char*, char**, locale_t);
--- /dev/null
+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);
--- /dev/null
+#include <stddef.h>
+
+int backtrace(void **, int);
+int madvise(void *, size_t, int);
--- /dev/null
+#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);
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))
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:
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)."""
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
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
):
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
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 #
# 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
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",
# 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 = [
#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
* 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)
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;
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;
}
if (itemsize == 0) {
PyErr_SetString(PyExc_ValueError,
"cannot determine count if itemsize is 0");
+ Py_DECREF(buf);
Py_DECREF(type);
return NULL;
}
PyErr_SetString(PyExc_ValueError,
"buffer size must be a multiple"\
" of element size");
+ Py_DECREF(buf);
Py_DECREF(type);
return NULL;
}
PyErr_SetString(PyExc_ValueError,
"buffer is smaller than requested"\
" size");
+ Py_DECREF(buf);
Py_DECREF(type);
return NULL;
}
&PyArray_Type, type,
1, &n, NULL, data,
NPY_ARRAY_DEFAULT, NULL, buf);
+ Py_DECREF(buf);
if (ret == NULL) {
return NULL;
}
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;
}
typedef union {
npy_cdouble npy_z;
#ifdef __cplusplus
- std::complex<double> c99z;
+ std::complex<double> c99_z;
#else
complex double c99_z;
#endif
typedef union {
npy_cfloat npy_z;
#ifdef __cplusplus
- std::complex<float> c99z;
+ std::complex<float> c99_z;
#else
complex float c99_z;
#endif
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");
import pathlib
import builtins
from decimal import Decimal
+import mmap
import numpy as np
import numpy.core._multiarray_tests as _multiarray_tests
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):
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) -> ( )")
# 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)
# 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:
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`,
format as format,
mixins as mixins,
scimath as scimath,
- stride_tricks as stride_stricks,
+ stride_tricks as stride_tricks,
)
from numpy.lib._version import (
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):
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')
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
):
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
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)
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')
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
[mypy]
plugins = numpy.typing.mypy_plugin
show_absolute_path = True
+implicit_reexport = False
[mypy-numpy]
ignore_errors = True
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}]
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}]]
# 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_]
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_]]
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]
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}
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_}]], ...]
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
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, ...]
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}]]
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
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
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]
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
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]]]
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:
#-----------------------------------
# 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'
#-------------------------------------------------------
"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
]
-cython==0.29.24
+cython==0.29.30
wheel==0.37.0
setuptools==59.2.0
hypothesis==6.24.1
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"
# 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__