summaryrefslogtreecommitdiff
path: root/doc/source/reference/c-api
Commit message (Collapse)AuthorAgeFilesLines
...
* DOC: Fix some target not found Sphinx warnings. (#20140)Chiara Marmo2021-12-011-0/+5
|
* DEP: remove allocation_tracking, deprecate PyDataMem_SetEventHook (#20394)Matti Picus2021-11-181-7/+9
| | | | | | | | | | | | | * DEP: remove allocation_tracking * DOC: add release note * DEP: deprecate PyDataMem_SetEventHook * DOC: fix name of release note * fixes from review * DOC: document deprecation of PyDataMem_EventHookFunc
* ENH: add a 'version' field to PyDataMem_Handlermattip2021-11-101-1/+2
|
* Merge pull request #20195 from WarrenWeckesser/doc-miscSebastian Berg2021-10-271-8/+14
|\ | | | | DOC: Two small changes in array.rst:
| * DOC: Two small changes in array.rst:warren2021-10-261-8/+14
| | | | | | | | | | | | * Include the return values of `PyArray_RegisterCanCast` in the description. * Correct the documentation of `PyArray_Scalar`.
* | MAINT: Only warn for transferred ownership if env variable is set (#20200)Matti Picus2021-10-272-3/+41
|/ | | | | | | | | | | | | Builds on gh-20194. Fixes breakage of SciPy in https://github.com/scipy/scipy/issues/14917 At some point we could flip the default to "warn" instead of "no warning" * make warning conditional on NUMPY_WARN_IF_NO_MEM_POLICY * add test, fix example code * fixes from review * typo
* DOC: add release note and move NEP 49 to Final (#20194)Matti Picus2021-10-261-0/+2
| | | | | | | * DOC: add release note and move NEP 49 to Final * fix link * fix release note
* ENH: Configurable allocator (#17582)Matti Picus2021-10-252-0/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes gh-17467. Adds a public struct to hold memory manipulation routines PyDataMem_Handler and two new API functions PyDataMem_SetHandler to replace the current routines with the new ones, and PyDataMem_GetHandlerName to get the string name of the current routines (either globally or for a specific ndarray object). This also changes the size of the ndarray object to hold the PyDataMem_Handler active when it was created so subsequent actions on its data memory will remain consistent. Tests and documentation are included. Along the way, I found some places in the code where the current policy is inconsistent (all data memory handling should have gone through npy_*_cache not PyDataMem_*) so even if this is rejected it might improve the cache handling. The PyDataMem_Handler has fields to override memcpy, these are currently not implemented: memcpy in the code base is untouched. I think this PR is invasive enough as-is, if desired memcpy can be handled in a follow-up PR. * ENH: add and use global configurable memory routines * ENH: add tests and a way to compile c-extensions from tests * fix allocation/free exposed by tests * DOC: document the new APIs (and some old ones too) * BUG: return void from FREE, also some cleanup * MAINT: changes from review * fixes from linter * setting ndarray->descr on 0d or scalars mess with FREE * make scalar allocation more consistent wrt np_alloc_cache * change formatting for sphinx * remove memcpy variants * update to match NEP 49 * ENH: add a python-level get_handler_name * ENH: add core.multiarray.get_handler_name * Allow closure-like definition of the data mem routines * Fix incompatible pointer warnings * Note PyDataMemAllocator and PyMemAllocatorEx differentiation Co-authored-by: Matti Picus <matti.picus@gmail.com> * Redefine default allocator handling * Always allocate new arrays using the current_handler * Search for the mem_handler name of the data owner * Sub-comparisons don't need a local mem_handler * Make the default_handler a valid PyDataMem_Handler * Fix PyDataMem_SetHandler description (NEP discussion) * Pass the allocators by reference * Implement allocator context-locality * Fix documentation, make PyDataMem_GetHandler return const * remove import of setuptools==49.1.3, doesn't work on python3.10 * Fix refcount leaks * fix function signatures in test * Return early on PyDataMem_GetHandler error (VOID_compare) * Add context/thread-locality tests, allow testing custom policies * ENH: add and use global configurable memory routines * ENH: add tests and a way to compile c-extensions from tests * fix allocation/free exposed by tests * DOC: document the new APIs (and some old ones too) * BUG: return void from FREE, also some cleanup * MAINT: changes from review * fixes from linter * setting ndarray->descr on 0d or scalars mess with FREE * make scalar allocation more consistent wrt np_alloc_cache * change formatting for sphinx * remove memcpy variants * update to match NEP 49 * ENH: add a python-level get_handler_name * ENH: add core.multiarray.get_handler_name * Allow closure-like definition of the data mem routines * Fix incompatible pointer warnings * Note PyDataMemAllocator and PyMemAllocatorEx differentiation Co-authored-by: Matti Picus <matti.picus@gmail.com> * Redefine default allocator handling * Always allocate new arrays using the current_handler * Search for the mem_handler name of the data owner * Sub-comparisons don't need a local mem_handler * Make the default_handler a valid PyDataMem_Handler * Fix PyDataMem_SetHandler description (NEP discussion) * Pass the allocators by reference * remove import of setuptools==49.1.3, doesn't work on python3.10 * fix function signatures in test * try to fix cygwin extension building * YAPF mem_policy test * Less empty lines, more comments (tests) * Apply suggestions from code review (set an exception and) Co-authored-by: Matti Picus <matti.picus@gmail.com> * skip test on cygwin * update API hash for changed signature * TST: add gc.collect to make sure cycles are broken * Implement thread-locality for PyPy Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net> * Update numpy/core/tests/test_mem_policy.py Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net> * fixes from review * update circleci config * fix test * make the connection between OWNDATA and having a allocator handle more explicit * improve docstring, fix flake8 for tests * update PyDataMem_GetHandler() from review * Implement allocator lifetime management * update NEP and add best-effort handling of error in PyDataMem_UserFREE * ENH: fix and test for blindly taking ownership of data * Update doc/neps/nep-0049.rst Co-authored-by: Elias Koromilas <elias.koromilas@gmail.com>
* Merge pull request #19981 from cmarmo/npyarray-enumsMatti Picus2021-10-012-54/+75
|\ | | | | DOC: Deindent some sphinx declarations to avoid warnings.
| * Add comments to prevent revert.Chiara Marmo2021-09-302-0/+21
| |
| * Fix scope of some sphinx declarations to avoid warnings.Chiara Marmo2021-09-282-54/+54
| |
* | DOC: Copy-edit and fix typos.Warren Weckesser2021-09-291-2/+2
|/
* DOC: Typos found by codespellDimitri Papadopoulos2021-09-212-3/+3
|
* Update doc/source/reference/c-api/array.rstCharles Harris2021-09-131-1/+1
| | | Co-authored-by: Melissa Weber Mendonça <melissawm@gmail.com>
* DOC: Added missing C-API functionsMukulika2021-09-081-14/+61
| | | | | | | | 1. PyArray_CopyObject 2. PyArray_MapIterArray 3. PyArray_MapIterSwapAxes 4. PyArray_MapIterNext 5. PyArray_MapIterArrayCopyIfOverlap
* DOC: Fix trivial doc typo. (#19692)Antony Lee2021-08-171-1/+1
|
* Dedent list of macros.Chiara Marmo2021-08-022-327/+330
|
* Fix scope of c:macro.Chiara Marmo2021-08-012-324/+327
|
* Merge pull request #19571 from seberg/ufunc-refactor-2021-normalMatti Picus2021-07-281-3/+7
|\ | | | | MAINT: Refactor UFunc core to use NEP 43 style dispatching
| * MAINT: Use the same pattern for the floating point error checkSebastian Berg2021-07-221-3/+4
| | | | | | | | Co-authored-by: Matti Picus <matti.picus@gmail.com>
| * DOC: use deprecated rather than note and delete old docstringSebastian Berg2021-07-221-6/+2
| |
| * MAINT: Refactor UFunc core to use NEP 43 style dispatching/promotionSebastian Berg2021-07-221-0/+7
| | | | | | | | | | | | | | | | | | The first (big) chunk of a multi-step process to update all ufuncs to NEP 43 style ufuncs. This limits itself to normal ufunc calls and sets ufunc.at and all reduce-like operations to the side. These would add another level of complexity.
* | Update doc/source/reference/c-api/array.rstChiara Marmo2021-07-271-1/+1
| | | | | | Co-authored-by: Matti Picus <matti.picus@gmail.com>
* | Remove PyArray_MultiIter_SIZE definition. Tentative definition for ↵Chiara Marmo2021-07-271-4/+10
| | | | | | | | PyArray_FinalizeFunc.
* | Address some comments.Chiara Marmo2021-07-271-11/+10
| |
* | Fix sphinx warnings in c-info.beyond-basics.Chiara Marmo2021-07-271-0/+12
|/
* DOC: Fix typosAdrian Gao2021-07-181-4/+4
|
* MAINT: Move masked strided/inner-loop code to its "final" place (#19370)Sebastian Berg2021-06-291-5/+1
| | | | | * MAINT: Move masked code 1:1 (does not work) * MAINT: Fixup code move and small follow-up fixes
* DOC: NeighborhoodIterator position on creationMarco Aurelio da Costa2021-06-081-1/+7
| | | | | | Document that NeighborhoodIterator will point to the begining of the data instead of the position pointed by iter on creation in the special case where data is contiguous.
* DEP: Disable PyUFunc_GenericFunction and PyUFunc_SetUsesArraysAsDataSebastian Berg2021-03-291-14/+0
| | | | | | | | Both functions have been deprecated in 1.19.x without complaints (so far). The first function is largely identical to a Python ufunc call. The second function had served internal NumPy purposes until NumPy 1.6 (probably), and since then had a comment that it should probably be removed (it was not documented).
* Merge pull request #16370 from takanori-pskq/i16217Matti Picus2020-12-165-120/+140
|\ | | | | DOC: Fix for building with sphinx 3
| * DOC: Fix for buildling with sphinx 3takanori-pskq2020-11-065-120/+140
| |
* | ENH,API: Store exported buffer info on the array (#16938)Sebastian Berg2020-11-261-0/+24
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ENH,API: Store exported buffer info on the array This speeds up array deallocation and buffer exports, since it removes the need to global dictionary lookups. It also somewhat simplifies the logic. The main advantage is prossibly less the speedup itself (which is not large compared to most things that happen in the livetime of an array), but rather that no unnecessary work is done for shortlived arrays, which never export a buffer. The downside of this approach is that the ABI changes for anyone who would be subclassing ndarray in C. * MAINT: Do not tag the NULL (no buffers exported) The allocation is not the right place to initialize to anything but NULL, so take the easy path and do not tag the NULL default. * TST: Add test for best try RuntimeError on corrupt buffer-info * Remove NPY_SIZEOF_PYARRAYOBJECT and add some documentation * Use 3 to tag the pointer and object for a "bad" one in the test * DEP: deprecate the NPY_SIZEOF_PYARRAYOBJECT macro * Tune down matti's deprecation to write the error instead. * Tweak macro, so that clang hopefully doesn't complain. * Use None instead of NULL in PyErr_WriteUnraisable, pypy seems to have a bug with it * Just comment it out... * Apply suggestions from code review Co-authored-by: Matti Picus <matti.picus@gmail.com> Co-authored-by: mattip <matti.picus@gmail.com>
* Update doc/source/reference/c-api/array.rstTakanori H2020-10-271-1/+1
| | | Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
* DOC: Fix some referencestakanori-pskq2020-10-262-5/+6
|
* DOC: Don't use Python highlighting for non-python codeEric Wieser2020-10-252-2/+6
|
* Merge pull request #17627 from takanori-pskq/i13114-array-structMatti Picus2020-10-252-5/+5
|\ | | | | DOC: Fix the references for ``__array_*__``
| * DOC: Fix the references for ``__array_*__``takanori-pskq2020-10-252-5/+5
| |
* | Merge pull request #17630 from takanori-pskq/i13114-capsuleMatti Picus2020-10-251-2/+3
|\ \ | | | | | | DOC: Replace ``PyCObject`` with ``PyCapsule``
| * | DOC: Replace ``PyCObject`` with ``PyCapsule``takanori-pskq2020-10-251-2/+3
| |/
* | Merge pull request #17629 from takanori-pskq/i13114-pyufunc-identityMatti Picus2020-10-251-3/+9
|\ \ | | | | | | DOC: Add ``identity_value`` to ``PyUFuncObject``
| * | DOC: Add ``identity_value`` to ``PyUFuncObject``takanori-pskq2020-10-251-3/+9
| |/
* | DOC: Add entries for macrostakanori-pskq2020-10-251-3/+29
|/
* DOC: Fixup for ``PyUFunc_*``takanori-pskq2020-10-241-1/+3
|
* DOC: Fix some referencestakanori-pskq2020-10-242-6/+7
|
* Merge pull request #17570 from takanori-pskq/i13114-feature-versionMatti Picus2020-10-221-12/+16
|\ | | | | DOC: Add the entry for ``NPY_FEATURE_VERSION``
| * DOC: Fixuptakanori-pskq2020-10-221-17/+16
| |
| * DOC: Add the entry for ``NPY_FEATURE_VERSION``takanori-pskq2020-10-151-0/+5
| |
* | DOC: Fix typostakanori-pskq2020-10-151-2/+2
|/
* DOC: Remove directives for some constantstakanori-pskq2020-10-142-16/+6
|