0
0
mirror of https://github.com/python/cpython.git synced 2024-12-01 11:15:56 +01:00
cpython/Modules
Victor Stinner 3f2d10132d Issue #29300: Convert _struct module to Argument Clinic
* 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.
2017-02-02 12:09:30 +01:00
..
_blake2 Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
_ctypes Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 10:23:58 +02:00
_decimal Issue #28769: The result of PyUnicode_AsUTF8AndSize() and PyUnicode_AsUTF8() 2017-01-22 23:07:07 +02:00
_io Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
_multiprocessing Issue #28152: Fix -Wunreachable-code warning on clang 2016-12-05 18:00:42 +01:00
_sha3 Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
_sqlite Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
cjkcodecs Run Argument Clinic: METH_VARARGS=>METH_FASTCALL 2017-01-17 02:21:47 +01:00
clinic Issue #29300: Convert _struct module to Argument Clinic 2017-02-02 12:09:30 +01:00
expat
zlib - Issue #29169: Update zlib to 1.2.10. 2017-01-31 13:49:48 +01:00
_asynciomodule.c _asyncio uses _PyObject_CallMethodIdObjArgs() 2016-12-15 09:05:11 +01:00
_bisectmodule.c Issue #28792: Remove aliases from _bisect 2016-11-24 23:31:59 +01:00
_bz2module.c
_codecsmodule.c
_collectionsmodule.c Merge doc fixes from 3.5 2017-01-14 09:54:57 +00:00
_cryptmodule.c
_csv.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
_curses_panel.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
_cursesmodule.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
_datetimemodule.c Merge 3.6 2017-01-03 23:47:39 +01:00
_dbmmodule.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
_elementtree.c Run Argument Clinic: METH_VARARGS=>METH_FASTCALL 2017-01-17 02:21:47 +01:00
_functoolsmodule.c Issue #28969: Fixed race condition in C implementation of functools.lru_cache. 2017-01-12 19:42:20 +02:00
_gdbmmodule.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
_hashopenssl.c _hashopenssl uses METH_FASTCALL 2017-01-17 04:20:26 +01:00
_heapqmodule.c
_json.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 10:23:58 +02:00
_localemodule.c
_lsprof.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
_lzmamodule.c Issue #27517: LZMA compressor and decompressor no longer raise exceptions if 2016-10-31 08:31:13 +02:00
_math.c Issue #28256: Cleanup _math.c 2016-10-18 16:29:27 +02:00
_math.h Issue #28256: Cleanup _math.c 2016-10-18 16:29:27 +02:00
_opcode.c
_operator.c Issue #20186: Converted the _operator module to Argument Clinic. 2017-01-19 17:44:13 +02:00
_pickle.c Issue #29368: Fix _Pickle_FastCall() usage in do_append() 2017-02-02 10:56:47 +01:00
_posixsubprocess.c
_randommodule.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
_scproxy.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
_sre.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
_ssl_data.h
_ssl.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
_stat.c
_struct.c Issue #29300: Convert _struct module to Argument Clinic 2017-02-02 12:09:30 +01:00
_testbuffer.c Add comment why the change in d83884b3a427 wasn't necessary. 2017-01-08 01:36:00 +01:00
_testcapimodule.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 10:23:58 +02:00
_testimportmultiple.c
_testmultiphase.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
_threadmodule.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
_tkinter.c Added the const qualifier to char* variables that refer to readonly internal 2016-11-20 10:16:47 +02:00
_tracemalloc.c
_weakref.c Issue #28427: old keys should not remove new values from 2016-12-27 14:19:20 +01:00
_winapi.c
addrinfo.h
arraymodule.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
atexitmodule.c
audioop.c
binascii.c Issue #29004: Merge crc_hqx() doc from 3.5 2016-12-24 07:44:03 +00:00
cmathmodule.c
config.c.in
errnomodule.c
faulthandler.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
fcntlmodule.c
fpectlmodule.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
fpetestmodule.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
gc_weakref.txt
gcmodule.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
getaddrinfo.c
getbuildinfo.c
getnameinfo.c
getpath.c Issue #19398: Extra slash no longer added to sys.path components in case of 2016-11-11 12:06:38 +02:00
grpmodule.c
hashlib.h
hashtable.c
hashtable.h
itertoolsmodule.c Issue #28959: Added private macro PyDict_GET_SIZE for retrieving the size of dict. 2016-12-16 16:18:57 +02:00
ld_so_aix.in Issue #10656: Fix out-of-tree building on AIX 2016-11-20 07:56:37 +00:00
main.c Issue #28768: Fix implicit declaration of function _setmode. Patch by Masayuki Yamamoto 2016-12-28 15:41:53 -08:00
makesetup merge 3.6 2017-01-16 00:05:54 -08:00
makexp_aix
mathmodule.c Issue #29282: Backed out changeset b33012ef1417 2017-01-21 13:10:52 +00:00
md5module.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
mmapmodule.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
nismodule.c
ossaudiodev.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
overlapped.c
parsermodule.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
posixmodule.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
posixmodule.h
pwdmodule.c
pyexpat.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
readline.c Replace PyObject_CallFunction() with fastcall 2016-12-01 14:51:04 +01:00
README
resource.c Issue #20191: Fixed a crash in resource.prlimit() when pass a sequence that 2016-12-19 08:05:39 +02:00
rotatingtree.c
rotatingtree.h
selectmodule.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
Setup.config.in
Setup.dist
sha1module.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
sha256module.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
sha512module.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
signalmodule.c
socketmodule.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
socketmodule.h
spwdmodule.c
sre_constants.h
sre_lib.h
sre.h Issue #28765: _sre.compile() now checks the type of groupindex and indexgroup 2016-11-22 23:04:39 +01:00
symtablemodule.c
syslogmodule.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
termios.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
testcapi_long.h
timemodule.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
tkappinit.c
tkinter.h
unicodedata_db.h
unicodedata.c Issue #28511: Use the "U" format instead of "O!" in PyArg_Parse*. 2016-10-23 15:12:25 +03:00
unicodename_db.h
winreparse.h
xxlimited.c merge 3.5 (#29398) 2017-01-31 23:31:10 -08:00
xxmodule.c
xxsubtype.c
zipimport.c Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever 2017-01-23 09:47:21 +02:00
zlibmodule.c

Source files for standard library extension modules,
and former extension modules that are now builtin modules.