summaryrefslogtreecommitdiff
path: root/Objects/memoryobject.c
Commit message (Collapse)AuthorAgeFilesLines
* closes bpo-39605: Fix some casts to not cast away const. (GH-18453)Andy Lester2020-02-111-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-301-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-11-011-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-071-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-051-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
|\
| * Issue #22668: Ensure that format strings survive slicing after casting.Stefan Krah2015-01-291-4/+52
| |
* | #16518: Bring error messages in harmony with docs ("bytes-like object")R David Murray2014-10-051-1/+1
| | | | | | | | | | | | | | | | | | | | Some time ago we changed the docs to consistently use the term 'bytes-like object' in all the contexts where bytes, bytearray, memoryview, etc are used. This patch (by Ezio Melotti) completes that work by changing the error messages that previously reported that certain types did "not support the buffer interface" to instead say that a bytes-like object is required. (The glossary entry for bytes-like object references the discussion of the buffer protocol in the docs.)
* | Issue #20186: memoryobject.c: add function signatures.Stefan Krah2014-05-181-5/+6
| |
* | Issue #21490: Add new C macros: Py_ABS() and Py_STRINGIFY()Victor Stinner2014-05-141-5/+2
|/ | | | | Keep _Py_STRINGIZE() in PC/pyconfig.h to not introduce a dependency between pyconfig.h and pymacros.h.
* ssue #19183: Implement PEP 456 'secure and interchangeable hash algorithm'.Christian Heimes2013-11-201-1/+1
| | | | Python now uses SipHash24 on all major platforms.
* Issue #19014: memoryview.cast() is now allowed on zero-length views.Antoine Pitrou2013-10-031-1/+1
|\
| * Issue #19014: memoryview.cast() is now allowed on zero-length views.Antoine Pitrou2013-10-031-1/+1
| |
* | Close #19078: memoryview now supports reversedNick Coghlan2013-10-021-1/+1
|/ | | | Patch by Claudiu Popa
* Fix error messages.Stefan Krah2013-02-191-2/+3
|
* Issue #15814: Use hash function that is compatible with the equalityStefan Krah2012-11-021-0/+8
| | | | definition from #15573.
* Issue #15855: added docstrings for memoryview methods and data descriptors ↵Alexander Belopolsky2012-09-031-13/+28
| | | | new in 3.3.
* Issue #15855: added docstrings for memoryview methods and data descriptors ↵Alexander Belopolsky2012-09-031-10/+41
|\ | | | | | | (merge 3.2).
| * Issue #15855: added docstrings for memoryview methods and data descriptors.Alexander Belopolsky2012-09-031-11/+43
| |
| * Merged revisions 88550 via svnmerge fromAntoine Pitrou2011-02-241-0/+5
| | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r88550 | antoine.pitrou | 2011-02-24 21:50:49 +0100 (jeu., 24 févr. 2011) | 4 lines Issue #11286: Raise a ValueError from calling PyMemoryView_FromBuffer with a buffer struct having a NULL data pointer. ........
* | Close #15573: use value-based memoryview comparisons (patch by Stefan Krah)Nick Coghlan2012-08-251-43/+283
| |
* | Add unused parameter to a METH_NOARGS function.Stefan Krah2012-07-281-5/+5
| |
* | Issue #12834: Fix PyBuffer_ToContiguous() for non-contiguous arrays.Stefan Krah2012-07-281-7/+70
| |
* | Issue #14930: Make memoryview objects weakrefable.Richard Oudkerk2012-05-281-1/+4
| |
* | Issue #14181: Preserve backwards compatibility for getbufferprocs that a) doStefan Krah2012-03-051-1/+1
| | | | | | | | | | not adhere to the new documentation and b) manage to clobber view->obj before returning failure.