8000 gh-135321: Changing data type of `size` variable for `BINSTRING` in `_pickle` by Legoclones · Pull Request #135322 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-135321: Changing data type of size variable for BINSTRING in _pickle #135322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added test and fixed NEWS message
  • Loading branch information
Legoclones committed Jun 10, 2025
commit 8e4382e308f1b31484185f6826dd438caed10860
5 changes: 5 additions & 0 deletions Lib/test/pickletester.py
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,11 @@ def test_large_32b_binunicode8(self):
self.check_unpickling_error((pickle.UnpicklingError, OverflowError),
dumped)

def test_large_binstring(self):
errmsg = 'UnpicklingError: BINSTRING pickle has negative byte count'
with self.assertRaisesRegex(pickle.UnpicklingError, errmsg 949A ):
self.loads(b'T\0\0\0\x80')

def test_get(self):
pickled = b'((lp100000\ng100000\nt.'
unpickled = self.loads(pickled)
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
The ``BINSTRING`` opcode of the C accelerator implementation of :mod:`pickle` was modified to have a signed 32-bit data type instead of 64-bit, keeping in line with the Python implementation of :mod:`pickle` and :mod:`pickletools`.
Raise a correct exception for values greater than 0x7fffffff for the ``BINSTRING`` opcode in the C implementation of :mod:`pickle`.
Loading
0