Serhiy Storchaka
a5a55902c1
Issue #29300 : Use Argument Clinic for getting struct object from the format.
9 years ago
Victor Stinner
c0f59ad145
Rename struct.unpack() 2nd parameter to "buffer"
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.
9 years ago
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.
9 years ago
Serhiy Storchaka
5ab81d787f
Issue #28959 : Added private macro PyDict_GET_SIZE for retrieving the size of dict.
9 years ago
Victor Stinner
de4ae3d486
Backed out changeset b9c9691c72c5
Issue #28858 : The change b9c9691c72c5 introduced a regression. It seems like
_PyObject_CallArg1() uses more stack memory than
PyObject_CallFunctionObjArgs().
9 years ago
Victor Stinner
27580c1fb5
Replace PyObject_CallFunctionObjArgs() with fastcall
* 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 .
9 years ago
Zachary Ware
99f11b48cd
Closes #21124 , #28337 : Call PyType_Ready on unpackiter_type.
Patch by Masayuki Yamamoto.
9 years ago
Zachary Ware
854adb1e01
Issue #21124 : Fix building _struct on Cygwin.
Patch by Masayuki Yamamoto.
9 years ago
Benjamin Peterson
a9296e7f3b
require C99 bool
9 years ago
Benjamin Peterson
af580dff4a
replace PY_LONG_LONG with long long
9 years ago
Benjamin Peterson
ed4aa83ff7
require a long long data type ( closes #27961 )
9 years ago
Mark Dickinson
7c4e409d07
Issue #11734 : Add support for IEEE 754 half-precision floats to the struct module. Original patch by Eli Stevens.
9 years ago
Martin Panter
b030991a5f
Issue #26535 : Correct docs regarding the struct buffer size
10 years ago
Serhiy Storchaka
48842714b9
Issue #22570 : Renamed Py_SETREF to Py_XSETREF.
10 years ago
Serhiy Storchaka
4a1e70fc31
Issue #20440 : Applied yet one patch for using Py_SETREF.
The patch is automatically generated, it replaces the code that uses Py_CLEAR.
10 years ago
Serhiy Storchaka
ef1585eb9a
Issue #25923 : Added more const qualifiers to signatures of static and private functions.
10 years ago
Serhiy Storchaka
2d06e84455
Issue #25923 : Added the const qualifier to static constant arrays.
10 years ago
Serhiy Storchaka
5c4064e8bd
Issue #25421 : __sizeof__ methods of builtin types now use dynamic basic size.
This allows sys.getsize() to work correctly with their subclasses with
__slots__ defined.
10 years ago
Serhiy Storchaka
4fdb68491e
Issue #22896 : Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()
and PyObject_AsWriteBuffer().
11 years ago
Victor Stinner
706768c687
Issue #22156 : Fix some "comparison between signed and unsigned integers"
compiler warnings in the Modules/ subdirectory.
12 years ago
Victor Stinner
45e8e2f218
Issue #21490 : Add new C macros: Py_ABS() and Py_STRINGIFY()
Keep _Py_STRINGIZE() in PC/pyconfig.h to not introduce a dependency between
pyconfig.h and pymacros.h.
12 years ago
doko@ubuntu.com
46c5deb130
- Modules/_struct.c (unpackiter_type): Define static.
12 years ago
Serhiy Storchaka
9594942716
Issue #18783 : Removed existing mentions of Python long type in docstrings,
error messages and comments.
13 years ago
Serhiy Storchaka
fff61f2cd3
Issue #14596 : The struct.Struct() objects now use more compact implementation.
13 years ago
Antoine Pitrou
9f14681959
Issue #17804 : New function ``struct.iter_unpack`` allows for streaming struct unpacking.
13 years ago
Kristján Valur Jónsson
9795ca44fb
Issue #10212 : Support new buffer interface for struct.unpack and
cStringIO
13 years ago
Antoine Pitrou
4de7457009
Issue #17173 : Remove uses of locale-dependent C functions (isalpha() etc.) 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).
13 years ago
Petri Lehtinen
92c28cace4
#14897 : Enhance error messages of struct.pack and struct.pack_into
Patch by Matti Mäki.
13 years ago
Petri Lehtinen
5c89c19eae
#14897 : Enhance error messages of struct.pack and struct.pack_into
Patch by Matti Mäki.
13 years ago
Christian Heimes
743e0cd6b5
Issue #16166 : Add PY_LITTLE_ENDIAN and PY_BIG_ENDIAN macros and unified
endianess detection and handling.
13 years ago
Meador Inge
90bc2dbcce
Issue #15402 : Simplify Struct.__sizeof__ and make tests more precise.
14 years ago
Meador Inge
6812346808
Issue #15402 : Simplify Struct.__sizeof__ and make tests more precise.
14 years ago
Meador Inge
b14d8c9bcf
Issue #15402 : Add a __sizeof__ method to struct.Struct.
Initial patch by Serhiy Storchaka.
14 years ago
Meador Inge
87c5b94c39
Issue #15402 : Add a __sizeof__ method to struct.Struct.
Initial patch by Serhiy Storchaka.
14 years ago
Antoine Pitrou
45d9c91d4b
Issue #3163 : The struct module gets new format characters 'n' and 'N'
supporting C integer types `ssize_t` and `size_t`, respectively.
14 years ago
Ezio Melotti
24b07bcba3
#11515 : fix several typos. Patch by Piotr Kasprzyk.
15 years ago
Ezio Melotti
42da663e6f
#11515 : fix several typos. Patch by Piotr Kasprzyk.
15 years ago
Victor Stinner
da9ec995f6
Issue #10783 : struct.pack() doesn't encode implicitly unicode to UTF-8
* Replace "bytes" by "bytes object" in struct error messages
* Document the API change in What's new in Python 3.2
* Fix test_wave
* Remove also ugly implicit conversions in test_struct
15 years ago
Georg Brandl
71c23d4473
Include structseq.h in Python.h, and remove now-redundant includes in individual sources.
15 years ago
Mark Dickinson
f417ae8d4c
Merged revisions 83241 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/release27-maint
................
r83241 | mark.dickinson | 2010-07-29 22:44:47 +0100 (Thu, 29 Jul 2010) | 9 lines
Merged revisions 83239 via svnmerge from
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.
........
................
16 years ago
Mark Dickinson
96527c3b59
Merged revisions 83239 via svnmerge from
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.
........
16 years ago
Mark Dickinson
2da63cc338
Merged revisions 83239 via svnmerge from
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.
........
16 years ago
Mark Dickinson
cf28b95800
Issue #9422 : Fix memory leak when re-initializing a struct.Struct object.
16 years ago
Mark Dickinson
a63726ffc8
Merged revisions 82945 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/release27-maint
................
r82945 | mark.dickinson | 2010-07-18 08:55:55 +0100 (Sun, 18 Jul 2010) | 14 lines
Merged revisions 82941,82943 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r82941 | mark.dickinson | 2010-07-18 08:29:02 +0100 (Sun, 18 Jul 2010) | 3 lines
Issue #9277 : Struct module: standard bool packing was incorrect if
char is unsigned. Thanks Stefan Krah for the patch.
........
r82943 | mark.dickinson | 2010-07-18 08:48:20 +0100 (Sun, 18 Jul 2010) | 1 line
Misc/NEWS entry for r82941.
........
................
16 years ago
Mark Dickinson
cac0b83b35
Merged revisions 82941,82943 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r82941 | mark.dickinson | 2010-07-18 08:29:02 +0100 (Sun, 18 Jul 2010) | 3 lines
Issue #9277 : Struct module: standard bool packing was incorrect if
char is unsigned. Thanks Stefan Krah for the patch.
........
r82943 | mark.dickinson | 2010-07-18 08:48:20 +0100 (Sun, 18 Jul 2010) | 1 line
Misc/NEWS entry for r82941.
........
16 years ago
Mark Dickinson
101d16cb14
Merged revisions 82941 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r82941 | mark.dickinson | 2010-07-18 08:29:02 +0100 (Sun, 18 Jul 2010) | 3 lines
Issue #9277 : Struct module: standard bool packing was incorrect if
char is unsigned. Thanks Stefan Krah for the patch.
........
16 years ago
Mark Dickinson
eff5d8594b
Issue #9277 : Struct module: standard bool packing was incorrect if
char is unsigned. Thanks Stefan Krah for the patch.
16 years ago
Benjamin Peterson
f092c7c1d7
Merged revisions 82628,82630 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r82628 | benjamin.peterson | 2010-07-07 13:44:05 -0500 (Wed, 07 Jul 2010) | 1 line
this needn't be in the loop
........
r82630 | benjamin.peterson | 2010-07-07 13:54:59 -0500 (Wed, 07 Jul 2010) | 1 line
don't ignore exceptions from PyObject_IsTrue
........
16 years ago
Benjamin Peterson
489113fd5f
Merged revisions 82628,82630 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r82628 | benjamin.peterson | 2010-07-07 13:44:05 -0500 (Wed, 07 Jul 2010) | 1 line
this needn't be in the loop
........
r82630 | benjamin.peterson | 2010-07-07 13:54:59 -0500 (Wed, 07 Jul 2010) | 1 line
don't ignore exceptions from PyObject_IsTrue
........
16 years ago
Benjamin Peterson
de73c4587f
don't ignore exceptions from PyObject_IsTrue
16 years ago