diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2009-03-29 16:58:21 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2009-03-29 16:58:21 (GMT) |
commit | b40b947c864e42e81718be1384110a1ac66f1a96 (patch) | |
tree | 378c294db58cf5ad4eb28ebd362428ff8bd1f40d /Doc | |
parent | 4feda2abc287fcde4ac57364b0cad3756d534fb3 (diff) | |
download | cpython-b40b947c864e42e81718be1384110a1ac66f1a96.zip cpython-b40b947c864e42e81718be1384110a1ac66f1a96.tar.gz cpython-b40b947c864e42e81718be1384110a1ac66f1a96.tar.bz2 |
Issue #5463: Remove _PY_STRUCT_RANGE_CHECKING constant from struct
module, and remove associated code from test_struct. This was a
mechanism for skipping some of the tests for overflow behaviour when
packing integers; it's no longer necessary.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/struct.rst | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst index bd8a7a9..28b0104 100644 --- a/Doc/library/struct.rst +++ b/Doc/library/struct.rst @@ -134,6 +134,16 @@ make it fit. For unpacking, the resulting bytes object always has exactly the specified number of bytes. As a special case, ``'0s'`` means a single, empty string (while ``'0c'`` means 0 characters). +When packing a value ``x`` using one of the integer formats (``'b'``, +``'B'``, ``'h'``, ``'H'``, ``'i'``, ``'I'``, ``'l'``, ``'L'``, +``'q'``, ``'Q'``), if ``x`` is outside the valid range for that format +then :exc:`struct.error` is raised. + +.. versionchanged:: 3.1 + In 3.0, some of the integer formats wrapped out-of-range values and + raised :exc:`DeprecationWarning` instead of :exc:`struct.error`. + + The ``'p'`` format character encodes a "Pascal string", meaning a short variable-length string stored in a fixed number of bytes. The count is the total number of bytes stored. The first byte stored is the length of the string, or |