summaryrefslogtreecommitdiffstats
path: root/Modules/_struct.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-30242: resolve some undefined behaviours in struct (#1418)Xiang Zhang2017-05-151-5/+9
|
* bpo-30224: remove outdated checks in struct (#1374)Xiang Zhang2017-05-151-47/+15
|
* bpo-29802: Fix reference counting in module-level struct functions (#1213)Serhiy Storchaka2017-04-201-0/+1
| | | | when pass arguments of wrong type.
* bpo-29649: Improve struct.pack_into() boundary error messages (#424)Andrew Nester2017-04-041-4/+30
|
* Issue #29300: Use Argument Clinic for getting struct object from the format.Serhiy Storchaka2017-02-041-65/+52
|
* Rename struct.unpack() 2nd parameter to "buffer"Victor Stinner2017-02-021-4/+4
| | | | | | | | | | Issue #29300: Rename struct.unpack() second parameter from "inputstr" to "buffer", and use the Py_buffer type. Fix also unit tests on struct.unpack() which passed a Unicode string instead of a bytes string as struct.unpack() second parameter. The purpose of test_trailing_counter() is to test invalid format strings, not to test the buffer parameter.
* Issue #29300: Convert _struct module to Argument ClinicVictor Stinner2017-02-021-226/+246
| | | | | | | | | | | | | | | | | | | | | | | | | * The struct module now requires contiguous buffers. * Convert most functions and methods of the _struct module to Argument Clinic * Use "Py_buffer" type for the "buffer" argument. Argument Clinic is responsible to create and release the Py_buffer object. * Use "PyStructObject *" type for self to avoid explicit conversions. * Add an unit test on the _struct.Struct.unpack_from() method to test passing arguments as keywords. * Rephrase docstrings. * Rename "fmt" argument to "format" in docstrings and the documentation. As a side effect, functions and methods which used METH_VARARGS calling convention like struct.pack() now use the METH_FASTCALL calling convention which avoids the creation of temporary tuple to pass positional arguments and so is faster. For example, struct.pack("i", 1) becomes 1.56x faster (-36%):: $ ./python -m perf timeit \ -s 'import struct; pack=struct.pack' 'pack("i", 1)' \ --compare-to=../default-ref/python Median +- std dev: 119 ns +- 1 ns -> 76.8 ns +- 0.4 ns: 1.56x faster (-36%) Significant (t=295.91) Patch co-written with Serhiy Storchaka.
* Issue #28959: Added private macro PyDict_GET_SIZE for retrieving the size of ↵Serhiy Storchaka2016-12-161-1/+1
| | | | dict.
* Backed out changeset b9c9691c72c5Victor Stinner2016-12-041-1/+1
| | | | | | Issue #28858: The change b9c9691c72c5 introduced a regression. It seems like _PyObject_CallArg1() uses more stack memory than PyObject_CallFunctionObjArgs().
* Replace PyObject_CallFunctionObjArgs() with fastcallVictor Stinner2016-12-011-1/+1
| | | | | | | | | | | | | | * PyObject_CallFunctionObjArgs(func, NULL) => _PyObject_CallNoArg(func) * PyObject_CallFunctionObjArgs(func, arg, NULL) => _PyObject_CallArg1(func, arg) PyObject_CallFunctionObjArgs() allocates 40 bytes on the C stack and requires extra work to "parse" C arguments to build a C array of PyObject*. _PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate memory on the C stack. This change is part of the fastcall project. The change on listsort() is related to the issue #23507.
* Closes #21124, #28337: Call PyType_Ready on unpackiter_type.Zachary Ware2016-10-041-0/+3
| | | | Patch by Masayuki Yamamoto.
* Issue #21124: Fix building _struct on Cygwin.Zachary Ware2016-10-021-1/+1
| | | | Patch by Masayuki Yamamoto.
* merge 3.5 (#28184)Benjamin Peterson2016-09-201-1/+1
|\
* | require C99 boolBenjamin Peterson2016-09-071-12/+5
| |
* | replace PY_LONG_LONG with long longBenjamin Peterson2016-09-061-26/+26
| |
* | require a long long data type (closes #27961)Benjamin Peterson2016-09-061-43/+0
| |
* | Issue #11734: Add support for IEEE 754 half-precision floats to the struct ↵Mark Dickinson2016-09-031-1/+75
| | | | | | | | module. Original patch by Eli Stevens.
* | merge headsGregory P. Smith2016-04-151-8/+8
|\ \ | |/
| * Issue #26535: Correct docs regarding the struct buffer sizeMartin Panter2016-04-151-8/+8
| |
* | Issue #22570: Renamed Py_SETREF to Py_XSETREF.Serhiy Storchaka2016-04-061-1/+1
|\ \ | |/
| * Issue #22570: Renamed Py_SETREF to Py_XSETREF.Serhiy Storchaka2016-04-061-1/+1
| |
* | Issue #20440: Applied yet one patch for using Py_SETREF.Serhiy Storchaka2015-12-271-2/+1
|\ \ | |/ | | | | The patch is automatically generated, it replaces the code that uses Py_CLEAR.
| * Issue #20440: Applied yet one patch for using Py_SETREF.Serhiy Storchaka2015-12-271-2/+1
| | | | | | | | The patch is automatically generated, it replaces the code that uses Py_CLEAR.
* | Issue #25923: Added more const qualifiers to signatures of static and ↵Serhiy Storchaka2015-12-251-3/+3
| | | | | | | | private functions.
* | Issue #25923: Added the const qualifier to static constant arrays.Serhiy Storchaka2015-12-251-2/+2
|/
* Issue #25421: __sizeof__ methods of builtin types now use dynamic basic size.Serhiy Storchaka2015-12-191-1/+1
| | | | | This allows sys.getsize() to work correctly with their subclasses with __slots__ defined.
* Issue #22896: Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()Serhiy Storchaka2015-02-021-10/+13
|\ | | | | | | and PyObject_AsWriteBuffer().
| * Issue #22896: Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()Serhiy Storchaka2015-02-021-10/+13
| | | | | | | | and PyObject_AsWriteBuffer().
* | Issue #22156: Fix some "comparison between signed and unsigned integers"Victor Stinner2014-08-151-2/+3
| | | | | | | | compiler warnings in the Modules/ subdirectory.
* | Issue #21490: Add new C macros: Py_ABS() and Py_STRINGIFY()Victor Stinner2014-05-141-5/+4
|/ | | | | Keep _Py_STRINGIZE() in PC/pyconfig.h to not introduce a dependency between pyconfig.h and pymacros.h.
* - Modules/_struct.c (unpackiter_type): Define static.doko@ubuntu.com2013-11-231-1/+1
|
* Issue #18783: Removed existing mentions of Python long type in docstrings,Serhiy Storchaka2013-08-271-1/+1
|\ | | | | | | error messages and comments.
| * Issue #18783: Removed existing mentions of Python long type in docstrings,Serhiy Storchaka2013-08-271-1/+1
| | | | | | | | error messages and comments.
* | Issue #14596: The struct.Struct() objects now use more compact implementation.Serhiy Storchaka2013-05-171-79/+94
| |
* | Issue #17804: New function ``struct.iter_unpack`` allows for streaming ↵Antoine Pitrou2013-04-261-0/+165
| | | | | | | | struct unpacking.
* | Issue #17173: Remove uses of locale-dependent C functions (isalpha() etc.) ↵Antoine Pitrou2013-02-091-2/+2
|\ \ | |/ | | | | | | | | | | | | in the interpreter. I've left a couple of them in: zlib (third-party lib), getaddrinfo.c (doesn't include Python.h, and probably obsolete), _sre.c (legitimate use for the re.LOCALE flag), mpdecimal (needs to build without Python.h).
| * Issue #17173: Remove uses of locale-dependent C functions (isalpha() etc.) ↵Antoine Pitrou2013-02-091-2/+2
| |\ | | | | | | | | | | | | | | | | | | | | | in the interpreter. I've left a couple of them in: zlib (third-party lib), getaddrinfo.c (doesn't include Python.h, and probably obsolete), _sre.c (legitimate use for the re.LOCALE flag), mpdecimal (needs to build without Python.h).
| | * Issue #17173: Remove uses of locale-dependent C functions (isalpha() etc.) ↵Antoine Pitrou2013-02-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | in the interpreter. I've left a couple of them in: zlib (third-party lib), getaddrinfo.c (doesn't include Python.h, and probably obsolete), _sre.c (legitimate use for the re.LOCALE flag).
* | | #14897: Enhance error messages of struct.pack and struct.pack_intoPetri Lehtinen2012-10-291-4/+14
|\ \ \ | |/ / | | | | | | Patch by Matti Mäki.
| * | #14897: Enhance error messages of struct.pack and struct.pack_intoPetri Lehtinen2012-10-291-4/+14
| |\ \ | | |/ | | | | | | Patch by Matti Mäki.
| | * #14897: Enhance error messages of struct.pack and struct.pack_intoPetri Lehtinen2012-10-291-4/+14
| | | | | | | | | | | | Patch by Matti Mäki.
* | | Issue #16166: Add PY_LITTLE_ENDIAN and PY_BIG_ENDIAN macros and unifiedChristian Heimes2012-10-171-11/+10
|/ / | | | | | | endianess detection and handling.
* | Issue #15402: Simplify Struct.__sizeof__ and make tests more precise.Meador Inge2012-07-291-6/+2
|\ \ | |/
| * Issue #15402: Simplify Struct.__sizeof__ and make tests more precise.Meador Inge2012-07-291-6/+2
| |
* | Issue #15402: Add a __sizeof__ method to struct.Struct.Meador Inge2012-07-231-0/+17
|\ \ | |/ | | | | Initial patch by Serhiy Storchaka.
| * Issue #15402: Add a __sizeof__ method to struct.Struct.Meador Inge2012-07-231-0/+17
| | | | | | | | Initial patch by Serhiy Storchaka.
* | Issue #3163: The struct module gets new format characters 'n' and 'N'Antoine Pitrou2011-10-061-1/+89
|/ | | | supporting C integer types `ssize_t` and `size_t`, respectively.
* #11515: Merge with 3.1.Ezio Melotti2011-03-151-1/+1
|\
| * #11515: fix several typos. Patch by Piotr Kasprzyk.Ezio Melotti2011-03-151-1/+1
| |
| * Merged revisions 83239 via svnmerge fromMark Dickinson2010-07-291-0/+3
| | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r83239 | mark.dickinson | 2010-07-29 22:41:59 +0100 (Thu, 29 Jul 2010) | 2 lines Issue #9422: Fix memory leak when re-initializing a struct.Struct object. ........