summaryrefslogtreecommitdiff
path: root/numpy
Commit message (Collapse)AuthorAgeFilesLines
* BUG: Histogramdd breaks on big arrays in Windows (#22561)Navpreet Singh2022-11-192-1/+12
| | | | | | | | | | | | | | | | | * BUG: Histogramdd breaks on big arrays in Windows Resolved the issue with line change from int to np.intp in numpy/numpy/lib/histograms.py * BUG: Histogramdd breaks on big arrays in Windows Resolved the issue with line change from int to np.intp in numpy/numpy/lib/histograms.py * Removed the binary files * Update test_histograms.py * Update test_histograms.py * Update test_histograms.py
* Merge pull request #22597 from charris/backport-22557Charles Harris2022-11-151-0/+5
|\ | | | | BUG: Decrement ref count in gentype_reduce if allocated memory not used
| * BUG: Decrement ref count in gentype_reduce when allocated memory not usedAayush Agrawal2022-11-151-0/+5
| |
* | Merge pull request #22593 from charris/backport-22447Charles Harris2022-11-151-1/+1
|\ \ | | | | | | TYP: Spelling alignment for array flag literal
| * | Align spelling with spelling in _GetItemKeys and documentation.Adam Knapp2022-11-151-1/+1
| |/
* | Merge pull request #22594 from charris/backport-22450Charles Harris2022-11-156-19/+46
|\ \ | | | | | | BUG: Fix boundschecking for `random.logseries`
| * | BUG: Fix boundschecking for `random.logseries`Sebastian Berg2022-11-156-19/+46
| |/ | | | | | | | | | | | | | | Logseries previously did not enforce bounds to be strictly exclusive for the upper bound, where it leads to incorrect behavior. The NOT_NAN check is removed, since it was never used: The current bounded version always excludes NaNs.
* | MAINT: Ensure graceful handling of large header sizesSebastian Berg2022-11-154-18/+126
|/ | | | | | | | | This ensures graceful handling of large header files. Unfortunately, it may be a bit inconvenient for users, thus the new kwarg and the work-around of also accepting allow-pickle. See also the documation here: https://docs.python.org/3.10/library/ast.html#ast.literal_eval
* TST: Make test_partial_iteration_cleanup robust but require leak checkerSebastian Berg2022-10-281-13/+9
| | | | | | | | This makes sure the test is not flaky, but the test now requires a leak checker (both valgrind or reference count based should work in CPython at least). Closes gh-21169
* BUG: Copy test_subclassing.py from main.Charles Harris2022-10-271-0/+28
|
* STY: Make linter happySebastian Berg2022-10-273-4/+3
| | | | Not new things, but in touched lines...
* TST: Rename setup to setup_method in f2py utils (inherited into Tests)Sebastian Berg2022-10-272-2/+2
|
* TST: Try using setup_class for `_Test_CCompilerOpt`Sebastian Berg2022-10-271-2/+2
|
* TST,MAINT: Replace most `setup` with `setup_method` (also teardown)Sebastian Berg2022-10-2732-145/+182
| | | | | | | | In some cases, the replacement is clearly not what is intended, in those (where setup was called explicitly), I mostly renamed `setup` to `_setup`. The `test_ccompile_opt` is a bit confusing, so left it right now (this will probably fail)
* TST, BLD: Fix failing aarch64 wheel builds.Charles Harris2022-10-111-1/+1
| | | | | | | | The aarch64 wheel build tests are failing with OOM. The new test for complex128 dot for huge vectors is responsible as the useable memory is incorrectly determined and the check for sufficient memory fails. The fix here is to define the `NPY_AVAILABLE_MEM="4 GB"` environment variable before the test call in `cibw_test_command.sh`.
* Adding missing Py_DECREF call on iterSicheng Zeng2022-10-051-0/+1
|
* Merge pull request #22391 from charris/backport-22372Charles Harris2022-10-051-2/+7
|\ | | | | DOC: Update delimiter param description.
| * DOC: Use versionchanged and add in note about newline chars.Ross Barnowski2022-10-051-3/+7
| |
| * DOC: Update delimiter param description.Ross Barnowski2022-10-051-1/+2
| | | | | | | | | | Explicitly state that only single-character delimiters are supported.
* | Merge pull request #22390 from charris/backport-22360Charles Harris2022-10-053-4/+2
|\ \ | | | | | | TST,TYP: Bump mypy to 0.981
| * | TST,TYP: Bump mypy to 0.981BvB932022-10-053-4/+2
| |/
* | Merge pull request #22389 from charris/backport-22359Charles Harris2022-10-052-0/+7
|\ \ | | | | | | TYP,MAINT: Change more overloads to play nice with pyright
| * | TYP,MAINT: Change more overloads to play nice with pyrightBvB932022-10-052-0/+7
| |/
* | Merge pull request #22388 from charris/backport-22357Charles Harris2022-10-054-3/+40
|\ \ | | | | | | TYP,ENH: Mark ``numpy.typing`` protocols as runtime checkable
| * | TYP,ENH: Mark `numpy.typing` protocols as runtime checkableBvB932022-10-054-3/+40
| |/
* | Merge pull request #22387 from charris/backport-22356Charles Harris2022-10-051-2/+6
|\ \ | | | | | | REV: Loosen ``lookfor``'s import try/except again
| * | REV: Losen `lookfor`'s import try/except again (#22356)Sebastian Berg2022-10-051-2/+6
| |/ | | | | | | | | | | | | | | | | | | | | Some BaseExceptions (at least the Skipped that pytest uses) need to be caught as well. It seems easiest to be practical and keep ignoring almost all exception in this particular code path. Effectively reverts parts of gh-19393 Closes gh-22345 Co-authored-by: Sebastian Berg <sebastianb@nvidia.com>
* | Merge pull request #22384 from charris/backport-22327Charles Harris2022-10-052-2/+12
|\ \ | | | | | | BUG: Fix complex vector dot with more than NPY_CBLAS_CHUNK elements
| * | BUG: Fix complex vector dot with more than NPY_CBLAS_CHUNK elementsSebastian Berg2022-10-052-2/+12
| |/ | | | | | | | | | | | | | | The iteration was simply using the wrong value, the larger value might even work sometimes, but then we do another iteration counting the remaining elements twice. Closes gh-22262
* | MAINT: random: remove `get_info` from "extending with Cython" exampleRalf Gommers2022-10-051-6/+9
|/ | | | xref gh-21431
* Add `__array_api_version__` to `numpy.array_api` namespaceMatthew Barber2022-10-021-1/+3
|
* BUG: Better report integer division overflow (backport) (#22230)Ganesh Kathiresan2022-09-085-67/+337
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * BUG, SIMD: Handle overflow errors Overflows for remainder/divmod/fmod * If a types minimum value is divided by -1, an overflow will be raised and result will be set to minimum * Handle overflow and return 0 in case of mod related operations * TST: New tests for overflow in division operations * SIMD: Removed cvtozero Co-authored-by: Rafael Cardoso Fernandes Sousa <rafaelcfsousa@ibm.com> * TST: Removed eval | Fixed raises cases * TST: Changed `raise` to `warns` * Changed `raise` to `warns` and test for `RuntimeWarning` * Added results check back * TST: Add additional tests for division-by-zero and integer overflow This introduces a helper to iterate through "interesting" array cases that could maybe be used in other places. Keep the other test intact, it adds a check for mixed types (which is just casts currently, but cannot hurt) and is otherwise thorough. * MAINT: Remove nested NPY_UNLIKELY in division paths I am not certain the unlikely cases make much sense to begin with, but they are certainly not helpful within an unlikely block. * TST: Add unsigned integers to integer divide-by-zero test * BUG: Added missing `NAME` key to loop generator * BUG, SIMD: Handle division overflow errors * If a types minimum value is divided by -1, an overflow will be raised and result will be set to minimum * TST: Modified tests to reflect new overflow * Update numpy/core/src/umath/loops_arithmetic.dispatch.c.src Co-authored-by: Rafael Sousa <90851201+rafaelcfsousa@users.noreply.github.com> Co-authored-by: Rafael Cardoso Fernandes Sousa <rafaelcfsousa@ibm.com> Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net> Co-authored-by: Rafael Sousa <90851201+rafaelcfsousa@users.noreply.github.com>
* Merge pull request #22224 from charris/backport-21928Charles Harris2022-09-071-1/+12
|\ | | | | BUG: Fix the implementation of numpy.array_api.vecdot
| * BUG: Fix the implementation of numpy.array_api.vecdot (#21928)Aaron Meurer2022-09-071-1/+12
| | | | | | | | | | | | | | * Fix the implementation of numpy.array_api.vecdot See https://data-apis.org/array-api/latest/API_specification/generated/signatures.linear_algebra_functions.vecdot.html * Use moveaxis + matmul instead of einsum in vecdot
* | Merge pull request #22223 from charris/backport-21981Charles Harris2022-09-073-2/+24
|\ \ | | | | | | TST: ensure ``np.equal.reduce`` raises a ``TypeError``
| * | BUG: Replace assert with correct errorSebastian Berg2022-09-072-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we cache a promoted version of the loop, that promoted can mismatch the correct one. This ends up being rejected later in the legacy paths (should be the only path currently used), but we should reject it here (or in principle we could reject it after cache lookup, but we are fixing up the operation DTypes here anyway, so we are looking at the signature). A call sequence reproducing this directly is: np.add(1, 2, signature=(bool, int, None)) # should fail np.add(True, 2) # A promoted loop np.add(1, 2, signature=(bool, int, None)) # should still fail Not that the errors differ, because the first one comes from the old type resolution code and is currently less precise
| * | TST: ensure `np.equal.reduce` raises a `TypeError`Saransh2022-09-071-0/+8
| |/
* | Merge pull request #22222 from charris/backport-22212Charles Harris2022-09-074-16/+25
|\ \ | | | | | | TYP,BUG: Reduce argument validation in C-based ``__class_getitem__``
| * | TYP,BUG: Reduce argument validation in C-based `__class_getitem__` (#22212)Bas van Beek2022-09-074-16/+25
| |/ | | | | | | | | | | | | | | | | Closes #22185 The __class_getitem__ implementations would previously perform basic validation of the passed value, i.e. it would check whether a tuple of the appropriate length was passed (e.g. np.dtype.__class_getitem__ would expect a single item or a length-1 tuple). As noted in aforementioned issue: this approach can cause issues when (a. 2 or more parameters are involved and (b. a subclasses is created one or more parameters are declared constant (e.g. a fixed dtype & variably shaped array). This PR fixes aforementioned issue by relaxing the runtime argument validation, thus mimicking the behavior of the standard library (more closely). While we could alternatively fix this by adding more special casing (e.g. only disable validation when cls is not np.ndarray), I'm not convinced this would be worth the additional complexity, especially since the standard library also has zero runtime validation for all of its Py_GenericAlias-based implementations of __class_getitem__. (Some edits by seberg to the commit message)
* | Merge pull request #22221 from charris/backport-22204Charles Harris2022-09-071-2/+7
|\ \ | | | | | | TST,BUG: Use fork context to fix MacOS savez test
| * | TST,BUG: Us context from spawn to fork in (#22204)Jyn Spring 琴春2022-09-071-2/+7
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since Python 3.8, the default start method for multiprocessing has been changed from fork to spawn on macOS The default start method is still fork on other Unix platforms[1], causing inconsistency on memory sharing model It will cause a memory-sharing problem for the test test_large_zip on macOS as the memory sharing model between spawn and fork is different The fix Change the start method for this test back to fork under this testcase context In this test case context, the bug that caused default start method changed to spawn for macOS will not be triggered It is context limited, so this change will not affect default start method other than test_large_zip All platforms have the same memory sharing model now After the change, test_large_zip is passed on macOS https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods Closes gh-22203
* | BUG: Introduce Unknown array type to deal with NDArray[Any] more gracefully.iantra2022-09-073-14/+62
| |
* | BUG: change overload order to play nice with pyright.iantra2022-09-071-27/+27
|/ | | | Pyright just chooses the first matching type whenever there is ambiguity in type resolution, which leads to NoReturn for the cross function in certain situations. Other overloads were changed to match. See ticket #22146
* Merge pull request #22214 from charris/backport-22024Charles Harris2022-09-063-232/+233
|\ | | | | BUG: Expose heapsort algorithms in a shared header
| * Expose heapsort algorithms in a shared headerserge-sans-paille2022-09-063-232/+233
| | | | | | | | Fix #22011
* | Merge pull request #22215 from charris/backport-22152Charles Harris2022-09-063-1/+12
|\ \ | | | | | | BUG: Support using libunwind for backtrack
| * | BUG: Support using libunwind for backtrackRin Cat (鈴猫)2022-09-063-1/+12
| |/ | | | | | | | | | | | | Some system (e.g. musl) do not have "execinfo.h", and the backtracking is provided by libunwind. Fix: #22084
* | MAINT: fix an incorrect pointer type usage in f2pyRalf Gommers2022-09-061-3/+3
|/ | | | | | | | | | | | | | | | | | | | | This was giving many warnings like this one in the SciPy build: ``` scipy/special/_specfunmodule.c: In function 'complex_double_from_pyobj': scipy/special/_specfunmodule.c:198:47: warning: passing argument 1 of 'PyArray_DATA' from incompatible pointer type [-Wincompatible-pointer-types] 198 | (*v).r = ((npy_cdouble *)PyArray_DATA(arr))->real; | ^~~ | | | PyObject * {aka struct _object *} In file included from /home/rgommers/code/numpy/numpy/core/include/numpy/ndarrayobject.h:12, from /home/rgommers/code/numpy/numpy/core/include/numpy/arrayobject.h:5, from /home/rgommers/code/numpy/numpy/f2py/src/fortranobject.h:16, from scipy/special/_specfunmodule.c:22: /home/rgommers/code/numpy/numpy/core/include/numpy/ndarraytypes.h:1524:29: note: expected 'PyArrayObject *' {aka 'struct tagPyArrayObject *'} but argument is of type 'PyObject *' {aka 'struct _object *'} 1524 | PyArray_DATA(PyArrayObject *arr) | ~~~~~~~~~~~~~~~^~~ ``` Fixing pointer mismatches is important for Pyodide/Emscripten.
* DEV: supporting IBM i systemGavinZhang2022-08-193-3/+16
|
* BUG, SIMD: Fix C++ AVX512/qsort on old gcc compilersSayed Adel2022-08-192-17/+13
|