Update dependency numpy to v1.21.0 [SECURITY]#36
Open
renovate[bot] wants to merge 1 commit intomasterfrom
Open
Update dependency numpy to v1.21.0 [SECURITY]#36renovate[bot] wants to merge 1 commit intomasterfrom
renovate[bot] wants to merge 1 commit intomasterfrom
Conversation
|
Pull request by bot. No need to analyze |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
==1.19.2->==1.21.0==1.9.2->==1.21.0GitHub Vulnerability Alerts
CVE-2021-33430
A Buffer Overflow vulnerability exists in NumPy 1.9.x in the PyArray_NewFromDescr_int function of ctors.c when specifying arrays of large dimensions (over 32) from Python code, which could let a malicious user cause a Denial of Service.
Release Notes
numpy/numpy
v1.21.0Compare Source
NumPy 1.21.0 Release Notes
The NumPy 1.21.0 release highlights are
PCG64DXSMbitgenerator for random numbers.In addition there are the usual large number of bug fixes and other
improvements.
The Python versions supported for this release are 3.7-3.9. Official
support for Python 3.10 will be added when it is released.
-O3results in many wrong warnings when running the tests.New functions
Add PCG64DXSM BitGenerator
Uses of the PCG64 BitGenerator in a massively-parallel context have
been shown to have statistical weaknesses that were not apparent at the
first release in numpy 1.17. Most users will never observe this weakness
and are safe to continue to use PCG64. We have introduced a new
PCG64DXSM BitGenerator that will eventually become the new default
BitGenerator implementation used by
default_rngin future releases.PCG64DXSM solves the statistical weakness while preserving the
performance and the features of PCG64.
See
upgrading-pcg64for more details.(gh-18906)
Expired deprecations
The
shapeargumentnumpy.unravel_indexcannot bepassed as
dimskeyword argument anymore. (Was deprecated in NumPy1.16.)
(gh-17900)
The function
PyUFunc_GenericFunctionhas been disabled. It wasdeprecated in NumPy 1.19. Users should call the ufunc directly using
the Python API.
(gh-18697)
The function
PyUFunc_SetUsesArraysAsDatahas been disabled. It wasdeprecated in NumPy 1.19.
(gh-18697)
The class
PolyBasehas been removed (deprecated in numpy 1.9.0).Please use the abstract
ABCPolyBaseclass instead.(gh-18963)
The unused
PolyErrorandPolyDomainErrorexceptions are removed.(gh-18963)
Deprecations
The
.dtypeattribute must return adtypeA
DeprecationWarningis now given if the.dtypeattribute of anobject passed into
np.dtypeor as adtype=objargument is not adtype. NumPy will stop attempting to recursively coerce the result of
.dtype.(gh-13578)
Inexact matches for
numpy.convolveandnumpy.correlateare deprecatednumpy.convolveandnumpy.correlatenowemit a warning when there are case insensitive and/or inexact matches
found for
modeargument in the functions. Pass full"same","valid","full"strings instead of"s","v","f"for themodeargument.(gh-17492)
np.typeDicthas been formally deprecatednp.typeDictis a deprecated alias fornp.sctypeDictand has been sofor over 14 years
(6689502).
A deprecation warning will now be issued whenever getting
np.typeDict.(gh-17586)
Exceptions will be raised during array-like creation
When an object raised an exception during access of the special
attributes
__array__or__array_interface__, this exception wasusually ignored. A warning is now given when the exception is anything
but AttributeError. To silence the warning, the type raising the
exception has to be adapted to raise an
AttributeError.(gh-19001)
Four
ndarray.ctypesmethods have been deprecatedFour methods of the
ndarray.ctypesobject have beendeprecated, as they are (undocumentated) implementation artifacts of
their respective properties.
The methods in question are:
_ctypes.get_data(use_ctypes.datainstead)_ctypes.get_shape(use_ctypes.shapeinstead)_ctypes.get_strides(use_ctypes.stridesinstead)_ctypes.get_as_parameter(use_ctypes._as_parameter_instead)(gh-19031)
Expired deprecations
The
shapeargumentnumpy.unravel_index] cannot bepassed as
dimskeyword argument anymore. (Was deprecated in NumPy1.16.)
(gh-17900)
The function
PyUFunc_GenericFunctionhas been disabled. It wasdeprecated in NumPy 1.19. Users should call the ufunc directly using
the Python API.
(gh-18697)
The function
PyUFunc_SetUsesArraysAsDatahas been disabled. It wasdeprecated in NumPy 1.19.
(gh-18697)
Remove deprecated
PolyBaseand unusedPolyErrorandPolyDomainErrorThe class
PolyBasehas been removed (deprecated in numpy 1.9.0).Please use the abstract
ABCPolyBaseclass instead.Furthermore, the unused
PolyErrorandPolyDomainErrorexceptions areremoved from the
numpy.polynomial.(gh-18963)
Compatibility notes
Error type changes in universal functions
The universal functions may now raise different errors on invalid input
in some cases. The main changes should be that a
RuntimeErrorwasreplaced with a more fitting
TypeError. When multiple errors werepresent in the same call, NumPy may now raise a different one.
(gh-15271)
__array_ufunc__argument validationNumPy will now partially validate arguments before calling
__array_ufunc__. Previously, it was possible to pass on invalidarguments (such as a non-existing keyword argument) when dispatch was
known to occur.
(gh-15271)
__array_ufunc__and additional positional argumentsPreviously, all positionally passed arguments were checked for
__array_ufunc__support. In the case ofreduce,accumulate, andreduceatall arguments may be passed by position. This means that whenthey were passed by position, they could previously have been asked to
handle the ufunc call via
__array_ufunc__. Since this depended on theway the arguments were passed (by position or by keyword), NumPy will
now only dispatch on the input and output array. For example, NumPy will
never dispatch on the
wherearray in a reduction such asnp.add.reduce.(gh-15271)
Validate input values in
Generator.uniformChecked that
high - low >= 0innp.random.Generator.uniform. RaisesValueErroriflow > high. Previously out-of-order inputs wereaccepted and silently swapped, so that if
low > high, the valuegenerated was
high + (low - high) * random().(gh-17921)
/usr/includeremoved from default include pathsThe default include paths when building a package with
numpy.distutilsno longer include
/usr/include. This path is normally added by thecompiler, and hardcoding it can be problematic. In case this causes a
problem, please open an issue. A workaround is documented in PR 18658.
(gh-18658)
Changes to comparisons with
dtype=...When the
dtype=(orsignature) arguments to comparison ufuncs(
equal,less, etc.) is used, this will denote the desired outputdtype in the future. This means that:
will give a
FutureWarningthat it will return anobjectarray in thefuture, which currently happens for:
due to the fact that
np.array(None)is already an object array. (Thisalso happens for some other dtypes.)
Since comparisons normally only return boolean arrays, providing any
other dtype will always raise an error in the future and give a
DeprecationWarningnow.(gh-18718)
Changes to
dtypeandsignaturearguments in ufuncsThe universal function arguments
dtypeandsignaturewhich are alsovalid for reduction such as
np.add.reduce(which is the implementationfor
np.sum) will now issue a warning when thedtypeprovided is nota "basic" dtype.
NumPy almost always ignored metadata, byteorder or time units on these
inputs. NumPy will now always ignore it and raise an error if byteorder
or time unit changed. The following are the most important examples of
changes which will give the error. In some cases previously the
information stored was not ignored, in all of these an error is now
raised:
Previously ignored the byte-order (affect if non-native)
The biggest impact is for timedelta or datetimes:
The examples always ignored the time unit "ns":
The following previously did use "ns" (as opposed to
arr.dtype)The same applies for functions like
np.sumwhich use these internally.This change is necessary to achieve consistent handling within NumPy.
If you run into these, in most cases pass for example
dtype=np.timedelta64which clearly denotes a generaltimedelta64without any unit or byte-order defined. If you need to specify the
output dtype precisely, you may do so by either casting the inputs or
providing an output array using
out=.NumPy may choose to allow providing an exact output
dtypehere in thefuture, which would be preceded by a
FutureWarning.(gh-18718)
Ufunc
signature=...anddtype=generalization andcastingThe behaviour for
np.ufunc(1.0, 1.0, signature=...)ornp.ufunc(1.0, 1.0, dtype=...)can now yield different loops in 1.21compared to 1.20 because of changes in promotion. When
signaturewaspreviously used, the casting check on inputs was relaxed, which could
lead to downcasting inputs unsafely especially if combined with
casting="unsafe".Casting is now guaranteed to be safe. If a signature is only partially
provided, for example using
signature=("float64", None, None), thiscould lead to no loop being found (an error). In that case, it is
necessary to provide the complete signature to enforce casting the
inputs. If
dtype="float64"is used or only outputs are set (e.g.signature=(None, None, "float64")the is unchanged. We expect thatvery few users are affected by this change.
Further, the meaning of
dtype="float64"has been slightly modified andnow strictly enforces only the correct output (and not input) DTypes.
This means it is now always equivalent to:
(If the ufunc has two inputs and one output). Since this could lead to
no loop being found in some cases, NumPy will normally also search for
the loop:
if the first search failed. In the future, this behaviour may be
customized to achieve the expected results for more complex ufuncs. (For
some universal functions such as
np.ldexpinputs can have differentDTypes.)
(gh-18880)
Distutils forces strict floating point model on clang
NumPy distutils will now always add the
-ffp-exception-behavior=strictcompiler flag when compiling with clang. Clang defaults to a non-strict
version, which allows the compiler to generate code that does not set
floating point warnings/errors correctly.
(gh-19049)
C API changes
Use of
ufunc->type_resolverand "type tuple"NumPy now normalizes the "type tuple" argument to the type resolver
functions before calling it. Note that in the use of this type resolver
is legacy behaviour and NumPy will not do so when possible. Calling
ufunc->type_resolverorPyUFunc_DefaultTypeResolveris stronglydiscouraged and will now enforce a normalized type tuple if done. Note
that this does not affect providing a type resolver, which is expected
to keep working in most circumstances. If you have an unexpected
use-case for calling the type resolver, please inform the NumPy
developers so that a solution can be found.
(gh-18718)
New Features
Added a mypy plugin for handling platform-specific
numpy.numberprecisionsA mypy plugin is now available for
automatically assigning the (platform-dependent) precisions of certain
numpy.numbersubclasses, including the likes ofnumpy.int_,numpy.intpandnumpy.longlong. See the documentation onscalar types <arrays.scalars.built-in>for a comprehensive overview of the affected classes.
Note that while usage of the plugin is completely optional, without it
the precision of above-mentioned classes will be inferred as
typing.Any.To enable the plugin, one must add it to their mypy [configuration file]
(https://mypy.readthedocs.io/en/stable/config_file.html):
(gh-17843)
Let the mypy plugin manage extended-precision
numpy.numbersubclassesThe mypy plugin, introduced in
numpy/numpy#17843, has
been expanded: the plugin now removes annotations for platform-specific
extended-precision types that are not available to the platform in
question. For example, it will remove
numpy.float128when not available.
Without the plugin all extended-precision types will, as far as mypy
is concerned, be available on all platforms.
To enable the plugin, one must add it to their mypy configuration
file:
(gh-18322)
New
min_digitsargument for printing float valuesA new
min_digitsargument has been added to the dragon4 float printingfunctions
numpy.format_float_positionalandnumpy.format_float_scientific. This kwd guaranteesthat at least the given number of digits will be printed when printing
in unique=True mode, even if the extra digits are unnecessary to
uniquely specify the value. It is the counterpart to the precision
argument which sets the maximum number of digits to be printed. When
unique=False in fixed precision mode, it has no effect and the precision
argument fixes the number of digits.
(gh-18629)
f2py now recognizes Fortran abstract interface blocks
numpy.f2pycan now parse abstract interface blocks.(gh-18695)
BLAS and LAPACK configuration via environment variables
Autodetection of installed BLAS and LAPACK libraries can be bypassed by
using the
NPY_BLAS_LIBSandNPY_LAPACK_LIBSenvironment variables.Instead, the link flags in these environment variables will be used
directly, and the language is assumed to be F77. This is especially
useful in automated builds where the BLAS and LAPACK that are installed
are known exactly. A use case is replacing the actual implementation at
runtime via stub library links.
If
NPY_CBLAS_LIBSis set (optional in addition toNPY_BLAS_LIBS),this will be used as well, by defining
HAVE_CBLASand appending theenvironment variable content to the link flags.
(gh-18737)
A runtime-subcriptable alias has been added for
ndarraynumpy.typing.NDArrayhas been added, a runtime-subscriptable alias fornp.ndarray[Any, np.dtype[~Scalar]]. The new type alias can be used forannotating arrays with a given dtype and unspecified shape.
NumPy does not support the annotating of array shapes as of 1.21,
this is expected to change in the future though (see
646{.interpreted-text role="pep"}).Examples
(gh-18935)
Improvements
Arbitrary
periodoption fornumpy.unwrapThe size of the interval over which phases are unwrapped is no longer
restricted to
2 * pi. This is especially useful for unwrappingdegrees, but can also be used for other intervals.
(gh-16987)
np.uniquenow returns singleNaNWhen
np.uniqueoperated on an array with multipleNaNentries, itsreturn included a
NaNfor each entry that wasNaNin the originalarray. This is now improved such that the returned array contains just
one
NaNas the last element.Also for complex arrays all
NaNvalues are considered equivalent (nomatter whether the
NaNis in the real or imaginary part). As therepresentant for the returned array the smallest one in the
lexicographical order is chosen - see
np.sortfor how thelexicographical order is defined for complex arrays.
(gh-18070)
Generator.rayleighandGenerator.geometricperformance improvedThe performance of Rayleigh and geometric random variate generation in
Generatorhas improved. These are both transformation of exponentialrandom variables and the slow log-based inverse cdf transformation has
been replaced with the Ziggurat-based exponential variate generator.
This change breaks the stream of variates generated when variates from
either of these distributions are produced.
(gh-18666)
Placeholder annotations have been improved
All placeholder annotations, that were previously annotated as
typing.Any, have been improved. Where appropiate they have beenreplaced with explicit function definitions, classes or other
miscellaneous objects.
(gh-18934)
Performance improvements
Improved performance in integer division of NumPy arrays
Integer division of NumPy arrays now uses
libdivide when the divisor is a constant. With
the usage of libdivide and other minor optimizations, there is a large
speedup. The
//operator andnp.floor_dividemakes use of the newchanges.
(gh-17727)
Improve performance of
np.saveandnp.loadfor small arraysnp.saveis now a lot faster for small arrays.np.loadis also faster for small arrays, but only when serializingwith a version >=
(3, 0).Both are done by removing checks that are only relevant for Python 2,
while still maintaining compatibility with arrays which might have been
created by Python 2.
(gh-18657)
Changes
numpy.piecewiseoutput class now matches the input classWhen
numpy.ndarraysubclasses are used on input tonumpy.piecewise, they are passed on to the functions.The output will now be of the same subclass as well.
(gh-18110)
Enable Accelerate Framework
With the release of macOS 11.3, several different issues that numpy was
encountering when using Accelerate Framework's implementation of BLAS
and LAPACK should be resolved. This change enables the Accelerate
Framework as an option on macOS. If additional issues are found, please
file a bug report against Accelerate using the developer feedback
assistant tool (https://developer.apple.com/bug-reporting/). We intend
to address issues promptly and plan to continue supporting and updating
our BLAS and LAPACK libraries.
(gh-18874)
Checksums
MD5
SHA256
v1.20.3Compare Source
NumPy 1.20.3 Release Notes
NumPy 1.20.3 is a bugfix release containing several fixes merged to the
main branch after the NumPy 1.20.2 release.
Contributors
A total of 7 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 15 pull requests were merged for this release.
datetime64missing type overload fordatetime.date...__all__in favor of explicit re-exports-faltivecon macOSChecksums
MD5
SHA256
v1.20.2Compare Source
NumPy 1.20.2 Release Notes
NumPy 1,20.2 is a bugfix release containing several fixes merged to the
main branch after the NumPy 1.20.1 release.
Contributors
A total of 7 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 20 pull requests were merged for this release.
diagflatcould overflow on windows or 32-bit platformscomplex_double_from_pyobj.like=overrides are used__getitem__,__mul__and...wherekeyword fornp.mean&np.varmethodsChecksums
MD5
SHA256
v1.20.1Compare Source
NumPy 1.20.1 Release Notes
NumPy 1.20.1 is a rapid bugfix release fixing several bugs and
regressions reported after the 1.20.0 release.
Highlights
fixed.
random.shuffleregression is fixed.Contributors
A total of 8 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 15 pull requests were merged for this release.
numpy.__init__.pyChecksums
MD5
SHA256
v1.20.0Compare Source
NumPy 1.20.0 Release Notes
This NumPy release is the largest so made to date, some 684 PRs
contributed by 184 people have been merged. See the list of highlights
below for more details. The Python versions supported for this release
are 3.7-3.9, support for Python 3.6 has been dropped. Highlights are
improvements can be expected pending feedback from users.
has been done in introducing universal functions that will ease use
of modern features across different hardware platforms. This work is
ongoing.
in order to provide an easier path to extending dtypes. This work is
ongoing but enough has been done to allow experimentation and
feedback.
This work is ongoing and part of the larger project to improve
NumPy's online presence and usefulness to new users.
readability and removes technical debt.
New functions
The random.Generator class has a new
permutedfunction.The new function differs from
shuffleandpermutationin that thesubarrays indexed by an axis are permuted rather than the axis being
treated as a separate 1-D array for every combination of the other
indexes. For example, it is now possible to permute the rows or columns
of a 2-D array.
(gh-15121)
sliding_window_viewprovides a sliding window view for numpy arraysnumpy.lib.stride\_tricks.sliding\_window\_viewconstructsviews on numpy arrays that offer a sliding or moving window access to
the array. This allows for the simple implementation of certain
algorithms, such as running means.
(gh-17394)
[numpy.broadcast_shapes]{.title-ref} is a new user-facing function
numpy.broadcast\_shapesgets the resulting shape frombroadcasting the given shape tuples against each other.
(gh-17535)
Deprecations
Using the aliases of builtin types like
np.intis deprecatedFor a long time,
np.inthas been an alias of the builtinint. Thisis repeatedly a cause of confusion for newcomers, and existed mainly for
historic reasons.
These aliases have been deprecated. The table below shows the full list
of deprecated aliases, along with their exact meaning. Replacing uses of
items in the first column with the contents of the second column will
work identically and silence the deprecation warning.
The third column lists alternative NumPy names which may occasionally be
preferential. See also
basics.types{.interpreted-text role="ref"} foradditional details.
numpy.boolboolnumpy.bool\_numpy.intintnumpy.int\_(default),numpy.int64, ornumpy.int32numpy.floatfloatnumpy.float64,numpy.float\_,numpy.double(equivalent)numpy.complexcomplexnumpy.complex128,numpy.complex\_,numpy.cdouble(equivalent)numpy.objectobjectnumpy.object\_numpy.strstrnumpy.str\_numpy.longintnumpy.int\_(Clong),numpy.longlong(largest integer type)numpy.unicodestrnumpy.unicode\_To give a clear guideline for the vast majority of cases, for the types
bool,object,str(andunicode) using the plain version isshorter and clear, and generally a good replacement. For
floatandcomplexyou can usefloat64andcomplex128if you wish to be moreexplicit about the precision.
For
np.inta direct replacement withnp.int_orintis also goodand will not change behavior, but the precision will continue to depend
on the computer and operating system. If you want to be more explicit
and review the current use, you have the following alternatives:
np.int64ornp.int32to specify the precision exactly. Thisensures that results cannot depend on the computer or operating
system.
np.int_orint(the default), but be aware that it depends onthe computer and operating system.
np.cint(int),np.int_(long),np.longlong.np.intpwhich is 32bit on 32bit machines 64bit on 64bit machines.This can be the best type to use for indexing.
When used with
np.dtype(...)ordtype=...changing it to the NumPyname as mentioned above will have no effect on the output. If used as a
scalar with:
changing it can subtly change the result. In this case, the Python
version
float(123)orint(12.)is normally preferable, although theNumPy version may be useful for consistency with NumPy arrays (for
example, NumPy behaves differently for things like division by zero).
(gh-14882)
Passing
shape=Noneto functions with a non-optional shape argument is deprecatedPreviously, this was an alias for passing
shape=(). This deprecationis emitted by
PyArray\_IntpConverterin the C API. If yourAPI is intended to support passing
None, then you should check forNoneprior to invoking the converter, so as to be able to distinguishNoneand().(gh-15886)
Indexing errors will be reported even when index result is empty
In the future, NumPy will raise an IndexError when an integer array
index contains out of bound values even if a non-indexed dimension is of
length 0. This will now emit a DeprecationWarning. This can happen when
the array is previously empty, or an empty slice is involved:
Previously the non-empty index
[20]was not checked for correctness.It will now be checked causing a deprecation warning whic
Configuration
📅 Schedule: "" (UTC).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR has been generated by WhiteSource Renovate. View repository job log here.