mirror of https://github.com/python/cpython
3f2d10132d
* 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. |
||
---|---|---|
.. | ||
_asynciomodule.c.h | ||
_bz2module.c.h | ||
_codecsmodule.c.h | ||
_cryptmodule.c.h | ||
_cursesmodule.c.h | ||
_datetimemodule.c.h | ||
_dbmmodule.c.h | ||
_elementtree.c.h | ||
_gdbmmodule.c.h | ||
_hashopenssl.c.h | ||
_lzmamodule.c.h | ||
_opcode.c.h | ||
_operator.c.h | ||
_pickle.c.h | ||
_sre.c.h | ||
_ssl.c.h | ||
_struct.c.h | ||
_tkinter.c.h | ||
_weakref.c.h | ||
_winapi.c.h | ||
arraymodule.c.h | ||
audioop.c.h | ||
binascii.c.h | ||
cmathmodule.c.h | ||
fcntlmodule.c.h | ||
grpmodule.c.h | ||
mathmodule.c.h | ||
md5module.c.h | ||
posixmodule.c.h | ||
pwdmodule.c.h | ||
pyexpat.c.h | ||
sha1module.c.h | ||
sha256module.c.h | ||
sha512module.c.h | ||
signalmodule.c.h | ||
spwdmodule.c.h | ||
unicodedata.c.h | ||
zlibmodule.c.h |