summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_struct.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.8] bpo-35714: Reject null characters in struct format strings (GH-16928) ↵Zackery Spytz2020-05-261-0/+7
| | | | | | | | (GH-20419) struct.error is now raised if there is a null character in a struct format string. (cherry picked from commit 3f59b55316f4c6ab451997902579aa69020b537c)
* bpo-30249: Improve struct.unpack_from() error messages (GH-6059)Xiang Zhang2018-03-101-4/+30
|
* Fix bytes warnings in test_struct (added in bpo-29802). (#4068)Serhiy Storchaka2017-10-211-2/+2
|
* bpo-21071: struct.Struct.format type is now str (#845)Victor Stinner2017-06-231-0/+8
|
* bpo-30245: Fix possible overflow when organize struct.pack_into error ↵Johan Liu2017-06-021-0/+10
| | | | message (#1682)
* bpo-29802: Fix reference counting in module-level struct functions (#1213)Serhiy Storchaka2017-04-201-0/+10
| | | | when pass arguments of wrong type.
* bpo-29649: Improve struct.pack_into() boundary error messages (#424)Andrew Nester2017-04-041-0/+20
|
* Rename struct.unpack() 2nd parameter to "buffer"Victor Stinner2017-02-021-3/+3
| | | | | | | | | | 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-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* require a long long data type (closes #27961)Benjamin Peterson2016-09-061-18/+3
|
* Issue #11734: Add support for IEEE 754 half-precision floats to the struct ↵Mark Dickinson2016-09-031-2/+105
| | | | module. Original patch by Eli Stevens.
* Issue #21741: Update 147 test modules to use test discovery.Zachary Ware2015-04-131-4/+1
| | | | | | | I have compared output between pre- and post-patch runs of these tests to make sure there's nothing missing and nothing broken, on both Windows and Linux. The only differences I found were actually tests that were previously *not* run.
* 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-7/+2
| |
* | Issue #17804: New function ``struct.iter_unpack`` allows for streaming ↵Antoine Pitrou2013-04-261-1/+73
| | | | | | | | struct unpacking.
* | Replace IOError with OSError (#16715)Andrew Svetlov2012-12-251-3/+3
|/
* Issue #15467: Merge 3.2Martin v. Löwis2012-07-291-30/+10
|\
| * Issue #15467: Move helpers for __sizeof__ tests into test_support.Martin v. Löwis2012-07-291-29/+10
| | | | | | | | Patch by Serhiy Storchaka.
* | Issue #15402: Simplify Struct.__sizeof__ and make tests more precise.Meador Inge2012-07-291-10/+41
|\ \ | |/
| * Issue #15402: Simplify Struct.__sizeof__ and make tests more precise.Meador Inge2012-07-291-10/+41
| |
* | MERGE: Better test for Issue #15402: Add a __sizeof__ method to struct.StructJesus Cea2012-07-231-4/+4
|\ \ | |/
| * Better test for Issue #15402: Add a __sizeof__ method to struct.StructJesus Cea2012-07-231-4/+4
| |
* | Issue #15402: Add a __sizeof__ method to struct.Struct.Meador Inge2012-07-231-0/+10
|\ \ | |/ | | | | Initial patch by Serhiy Storchaka.
| * Issue #15402: Add a __sizeof__ method to struct.Struct.Meador Inge2012-07-231-0/+10
| | | | | | | | Initial patch by Serhiy Storchaka.
* | Issue #3163: The struct module gets new format characters 'n' and 'N'Antoine Pitrou2011-10-061-25/+41
|/ | | | supporting C integer types `ssize_t` and `size_t`, respectively.
* #11565: Merge with 3.1.Ezio Melotti2011-03-161-1/+1
|\
| * #11565: Fix several typos. Patch by Piotr Kasprzyk.Ezio Melotti2011-03-161-1/+1
| |
| * Merged revisions 82637 via svnmerge fromBenjamin Peterson2010-07-071-4/+8
| | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r82637 | benjamin.peterson | 2010-07-07 17:45:06 -0500 (Wed, 07 Jul 2010) | 1 line ValueError in this case is also acceptable ........
| * Merged revisions 82628,82630 via svnmerge fromBenjamin Peterson2010-07-071-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ........
| * Merged revisions 81897-81898,81902 via svnmerge fromMark Dickinson2010-06-111-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r81897 | mark.dickinson | 2010-06-11 17:56:34 +0100 (Fri, 11 Jun 2010) | 1 line Avoid possible undefined behaviour from signed overflow. ........ r81898 | mark.dickinson | 2010-06-11 20:05:08 +0100 (Fri, 11 Jun 2010) | 1 line Fix an incorrect return type. ........ r81902 | mark.dickinson | 2010-06-11 20:50:30 +0100 (Fri, 11 Jun 2010) | 1 line Fix more undefined-behaviour inducing overflow checks in struct module. ........
| * Merged revisions 78692 via svnmerge fromMark Dickinson2010-03-051-6/+2
| | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r78692 | mark.dickinson | 2010-03-05 14:44:08 +0000 (Fri, 05 Mar 2010) | 1 line Remove unused imports & clean up sys imports in test_struct. ........
| * Merged revisions 73715 via svnmerge fromGeorg Brandl2009-08-131-2/+2
| | | | | | | | | | | | | | | | | | | | svn+ssh://svn.python.org/python/branches/py3k ........ r73715 | benjamin.peterson | 2009-07-01 01:06:06 +0200 (Mi, 01 Jul 2009) | 1 line convert old fail* assertions to assert* ........
* | Issue #10783: struct.pack() doesn't encode implicitly unicode to UTF-8Victor Stinner2010-12-281-57/+46
| | | | | | | | | | | | | | * 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
* | Issue #8990: array.fromstring() and array.tostring() get renamed toAntoine Pitrou2010-09-011-4/+4
| | | | | | | | | | | | frombytes() and tobytes(), respectively, to avoid confusion. Furthermore, array.frombytes(), array.extend() as well as the array.array() constructor now accept bytearray objects. Patch by Thomas Jollans.
* | Add test for memory leak reported in issue 9422.Mark Dickinson2010-08-011-1/+6
| |
* | Issue #4770: Restrict binascii module to accept only bytes (as specified).Florent Xicluna2010-07-271-0/+1
| | | | | | | | And fix the email package to encode to ASCII instead of ``raw-unicode-escape`` before ASCII-to-binary decoding.
* | Yield more information on failure in test_struct boolean test.Mark Dickinson2010-07-121-2/+7
| |
* | ValueError is eventually what we want to move to, I supposeBenjamin Peterson2010-07-101-2/+2
| |
* | wrapBenjamin Peterson2010-07-091-1/+2
| |
* | allow more exceptionsBenjamin Peterson2010-07-091-3/+3
| |
* | OverflowError is fineBenjamin Peterson2010-07-091-1/+2
| |
* | ValueError in this case is also acceptableBenjamin Peterson2010-07-071-4/+8
| |
* | don't ignore exceptions from PyObject_IsTrueBenjamin Peterson2010-07-071-0/+6
| |
* | this needn't be in the loopBenjamin Peterson2010-07-071-2/+2
| |
* | Fix more undefined-behaviour inducing overflow checks in struct module.Mark Dickinson2010-06-111-0/+2
| |
* | Avoid possible undefined behaviour from signed overflow.Mark Dickinson2010-06-111-0/+5
| |
* | Issue #3129: Trailing digits in format string are no longer ignored.Alexander Belopolsky2010-06-111-1/+27
| |
* | Merged revisions 79745 via svnmerge fromMark Dickinson2010-04-041-10/+31
| | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r79745 | mark.dickinson | 2010-04-04 09:43:04 +0100 (Sun, 04 Apr 2010) | 3 lines Issue #8300 (__index__ handling in struct.pack): Remove redundant check and improve test coverage. Thanks Meador Inge for the patch. ........
* | Merged revisions 79740 via svnmerge fromEzio Melotti2010-04-041-8/+8
| | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r79740 | ezio.melotti | 2010-04-04 10:00:02 +0300 (Sun, 04 Apr 2010) | 1 line Use more specific assert* methods in test_struct. ........