summaryrefslogtreecommitdiffstats
path: root/Objects/memoryobject.c
Commit message (Collapse)AuthorAgeFilesLines
* gh-104223: Fix issues with inheriting from buffer classes (#104227)Jelle Zijlstra2023-05-081-1/+44
| | | Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-102500: Implement PEP 688 (#102521)Jelle Zijlstra2023-05-041-6/+34
| | | Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-83791: Raise TypeError for len(memoryview_0d) (#18463)Eric Wieser2023-04-221-1/+5
| | | Changes the behaviour of `len` on a zero-dimensional `memoryview` to raise `TypeError`. Previously, `len` would return `1`.
* gh-99300: Use Py_NewRef() in Objects/ directory (#99354)Victor Stinner2022-11-101-19/+10
| | | | Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Objects/ directory.
* gh-90751: memoryview now supports half-float (#96738)Dong-hee Na2022-09-101-3/+33
| | | | Co-authored-by: Antoine Pitrou <antoine@python.org>
* gh-92888: Fix memoryview bad `__index__` use after free (GH-92946)Ken Jin2022-06-171-19/+36
| | | | Co-authored-by: chilaxan <35645806+chilaxan@users.noreply.github.com> Co-authored-by: Serhiy Storchaka <3659035+serhiy-storchaka@users.noreply.github.com>
* gh-93741: Add private C API _PyImport_GetModuleAttrString() (GH-93742)Serhiy Storchaka2022-06-141-8/+2
| | | | | | It combines PyImport_ImportModule() and PyObject_GetAttrString() and saves 4-6 lines of code on every use. Add also _PyImport_GetModuleAttr() which takes Python strings as arguments.
* GH-92804: Fix memory leak in memoryview iterator (gh-92805)Kumar Aditya2022-05-141-3/+3
|
* bpo-46670: Remove unused macros in the Objects directory (GH-31193)Victor Stinner2022-02-071-8/+0
|
* bpo-46140: take more Py_buffer arguments as const * (GH-30217)David Hewitt2021-12-221-9/+9
|
* bpo-45434: Remove pystrhex.h header file (GH-28923)Victor Stinner2021-10-131-4/+4
| | | | | | | | | | | | | | | Move Include/pystrhex.h to Include/internal/pycore_strhex.h. The header file only contains private functions. The following C extensions are now built with Py_BUILD_CORE_MODULE macro defined to get access to the internal C API: * _blake2 * _hashopenssl * _md5 * _sha1 * _sha3 * _ssl * binascii
* bpo-43977: Use tp_flags for collection matching (GH-25723)Mark Shannon2021-04-301-1/+2
| | | | | | | | | | | | | * Add Py_TPFLAGS_SEQUENCE and Py_TPFLAGS_MAPPING, add to all relevant standard builtin classes. * Set relevant flags on collections.abc.Sequence and Mapping. * Use flags in MATCH_SEQUENCE and MATCH_MAPPING opcodes. * Inherit Py_TPFLAGS_SEQUENCE and Py_TPFLAGS_MAPPING. * Add NEWS * Remove interpreter-state map_abc and seq_abc fields.
* bpo-41732: add iterator to memoryview (GH-22119)dxflores2020-09-081-1/+107
|
* bpo-41262: Convert memoryview to Argument Clinic. (GH-21421)Serhiy Storchaka2020-07-181-73/+74
|
* bpo-40792: Make the result of PyNumber_Index() always having exact type int. ↵Serhiy Storchaka2020-05-281-6/+6
| | | | | | | | | | | | (GH-20443) Previously, the result could have been an instance of a subclass of int. Also revert bpo-26202 and make attributes start, stop and step of the range object having exact type int. Add private function _PyNumber_Index() which preserves the old behavior of PyNumber_Index() for performance to use it in the conversion functions like PyLong_AsLong().
* bpo-40268: Remove unused pycore_pymem.h includes (GH-19531)Victor Stinner2020-04-151-1/+0
|
* bpo-40268: Remove a few pycore_pystate.h includes (GH-19510)Victor Stinner2020-04-141-1/+0
|
* bpo-40170: Add _PyIndex_Check() internal function (GH-19426)Victor Stinner2020-04-081-3/+5
| | | | | | | | | Add _PyIndex_Check() function to the internal C API: fast inlined verson of PyIndex_Check(). Add Include/internal/pycore_abstract.h header file. Replace PyIndex_Check() with _PyIndex_Check() in C files of Objects and Python subdirectories.
* Give proper credits for the memoryview implementation. (#18626)Stefan Krah2020-02-241-1/+11
|
* closes bpo-39605: Fix some casts to not cast away const. (GH-18453)Andy Lester2020-02-121-4/+4
| | | | | | | | | | | | | | | gcc -Wcast-qual turns up a number of instances of casting away constness of pointers. Some of these can be safely modified, by either: Adding the const to the type cast, as in: - return _PyUnicode_FromUCS1((unsigned char*)s, size); + return _PyUnicode_FromUCS1((const unsigned char*)s, size); or, Removing the cast entirely, because it's not necessary (but probably was at one time), as in: - PyDTrace_FUNCTION_ENTRY((char *)filename, (char *)funcname, lineno); + PyDTrace_FUNCTION_ENTRY(filename, funcname, lineno); These changes will not change code, but they will make it much easier to check for errors in consts
* bpo-39245: Switch to public API for Vectorcall (GH-18460)Petr Viktorin2020-02-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The bulk of this patch was generated automatically with: for name in \ PyObject_Vectorcall \ Py_TPFLAGS_HAVE_VECTORCALL \ PyObject_VectorcallMethod \ PyVectorcall_Function \ PyObject_CallOneArg \ PyObject_CallMethodNoArgs \ PyObject_CallMethodOneArg \ ; do echo $name git grep -lwz _$name | xargs -0 sed -i "s/\b_$name\b/$name/g" done old=_PyObject_FastCallDict new=PyObject_VectorcallDict git grep -lwz $old | xargs -0 sed -i "s/\b$old\b/$new/g" and then cleaned up: - Revert changes to in docs & news - Revert changes to backcompat defines in headers - Nudge misaligned comments
* bpo-38631: Avoid Py_FatalError() in _memory_release() (GH-18214)Victor Stinner2020-01-271-1/+2
| | | | | If the export count is negative, _memory_release() now raises a SystemError and returns -1, rather than calling Py_FatalError() which aborts the process.
* bpo-37483: add _PyObject_CallOneArg() function (#14558)Jeroen Demeyer2019-07-041-2/+2
|
* bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async ↵Jeroen Demeyer2019-05-311-4/+4
| | | | | | | | | (GH-13464) Automatically replace tp_print -> tp_vectorcall_offset tp_compare -> tp_as_async tp_reserved -> tp_as_async
* bpo-22385: Support output separators in hex methods. (#13578)Gregory P. Smith2019-05-291-8/+37
| | | | | | | | | | | | | | | | | | * bpo-22385: Support output separators in hex methods. Also in binascii.hexlify aka b2a_hex. The underlying implementation behind all hex generation in CPython uses the same pystrhex.c implementation. This adds support to bytes, bytearray, and memoryview objects. The binascii module functions exist rather than being slated for deprecation because they return bytes rather than requiring an intermediate step through a str object. This change was inspired by MicroPython which supports sep in its binascii implementation (and does not yet support the .hex methods). https://bugs.python.org/issue22385
* bpo-33012: Fix compilation warnings in memoryobject.c and ↵Stéphane Wirtel2019-03-051-1/+1
| | | | | | _collectionsmodule.c (GH-12179) Cast function pointers to (void(*)(void)) before casting to (PyCFunction) to make "warning: cast between incompatible function types" false alarm quiet.
* bpo-35845: Add order={'C', 'F', 'A'} parameter to memoryview.tobytes(). (#11730)Stefan Krah2019-02-021-9/+35
|
* bpo-33029: Fix signatures of getter and setter functions. (GH-10746)Serhiy Storchaka2018-11-271-9/+9
| | | Fix also return type for few other functions (clear, releasebuffer).
* bpo-33012: Fix invalid function cast warnings with gcc 8. (GH-6749)Serhiy Storchaka2018-11-271-1/+1
| | | | | | Fix invalid function cast warnings with gcc 8 for method conventions different from METH_NOARGS, METH_O and METH_VARARGS excluding Argument Clinic generated code.
* bpo-35081: Add Include/internal/pycore_object.h (GH-10640)Victor Stinner2018-11-211-0/+1
| | | | Move _PyObject_GC_TRACK() and _PyObject_GC_UNTRACK() from Include/objimpl.h to Include/internal/pycore_object.h.
* bpo-35081: Rename internal headers (GH-10275)Victor Stinner2018-11-121-2/+2
| | | | | | | | | | | | | | Rename Include/internal/ headers: * pycore_hash.h -> pycore_pyhash.h * pycore_lifecycle.h -> pycore_pylifecycle.h * pycore_mem.h -> pycore_pymem.h * pycore_state.h -> pycore_pystate.h Add missing headers to Makefile.pre.in and PCbuild: * pycore_condvar.h. * pycore_hamt.h * pycore_pyhash.h
* bpo-35081: Add pycore_ prefix to internal header files (GH-10263)Victor Stinner2018-10-311-2/+2
| | | | | | | | | | | | | | | | | | | | * Rename Include/internal/ header files: * pyatomic.h -> pycore_atomic.h * ceval.h -> pycore_ceval.h * condvar.h -> pycore_condvar.h * context.h -> pycore_context.h * pygetopt.h -> pycore_getopt.h * gil.h -> pycore_gil.h * hamt.h -> pycore_hamt.h * hash.h -> pycore_hash.h * mem.h -> pycore_mem.h * pystate.h -> pycore_state.h * warnings.h -> pycore_warnings.h * PCbuild project, Makefile.pre.in, Modules/Setup: add the Include/internal/ directory to the search paths of header files. * Update includes. For example, replace #include "internal/mem.h" with #include "pycore_mem.h".
* bpo-33176: Add a toreadonly() method to memoryviews. (GH-6466)Antoine Pitrou2018-04-141-0/+19
|
* bpo-30860: Consolidate stateful runtime globals. (#3397)Eric Snow2017-09-081-0/+2
| | | | | | | * group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py).
* Expand the PySlice_GetIndicesEx macro. (#1023)Serhiy Storchaka2017-04-081-2/+2
|
* bpo-29865: Use PyXXX_GET_SIZE macros rather than Py_SIZE for concrete types. ↵Serhiy Storchaka2017-03-211-1/+1
| | | | (#748)
* Merge 3.5.Stefan Krah2016-12-301-1/+1
|\
| * Issue #29111: Fix memoryview signature.Stefan Krah2016-12-301-1/+1
| |
* | use static inline instead of Py_LOCAL_INLINEBenjamin Peterson2016-09-081-16/+16
| |
* | require C99 boolBenjamin Peterson2016-09-071-20/+0
| |
* | replace PY_LONG_LONG with long longBenjamin Peterson2016-09-061-17/+17
| |
* | require a long long data type (closes #27961)Benjamin Peterson2016-09-061-12/+0
| |
* | Issue #25923: Added more const qualifiers to signatures of static and ↵Serhiy Storchaka2015-12-251-2/+2
|/ | | | private functions.
* Fix Visual Studio warning.Stefan Krah2015-11-101-1/+1
|
* Iaaue #25598: Fix memory_hex from #9951 for non-contiguous buffers.Stefan Krah2015-11-101-1/+16
|
* Issue #15944: memoryview: Allow arbitrary formats when casting to bytes.Stefan Krah2015-08-081-8/+2
| | | | Original patch by Martin Panter.
* Implements issue #9951: Adds a hex() method to bytes, bytearray, & memoryview.Gregory P. Smith2015-04-251-0/+14
| | | | | | | Also updates a few internal implementations of the same thing to use the new built-in code. Contributed by Arnon Yaari.
* Issue #23632: Memoryviews now allow tuple indexing (including for ↵Antoine Pitrou2015-03-191-29/+120
| | | | multi-dimensional memoryviews).
* Removed unintentional trailing spaces in non-external and non-generated C files.Serhiy Storchaka2015-03-181-3/+3
|
* Closes #22668: Merge from 3.4.Stefan Krah2015-01-291-4/+52
|\