Skip to content

Commit 39fc1dd

Browse files
committed
Added test for issue 135241
1 parent 6ccd46e commit 39fc1dd

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

Lib/test/test_pickle.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,16 @@ class CUnpicklerTests(PyUnpicklerTests):
376376
bad_stack_errors = (pickle.UnpicklingError,)
377377
truncated_errors = (pickle.UnpicklingError,)
378378

379+
def test_issue135241(self):
380+
# C implementation should check for hardcoded values 00 and 01
381+
# when getting booleans from the INT opcode. Doing a str comparison
382+
# to bypass truthy/falsy comparisons. These payloads should return
383+
# 0, not False.
384+
out1 = self.loads(b'I+0\n.')
385+
self.assertTrue(str(out1) == str(0))
386+
out2 = self.loads(b'I 0\n.')
387+
self.assertTrue(str(out2) == str(0))
388+
379389
class CPicklingErrorTests(PyPicklingErrorTests):
380390
pickler = _pickle.Pickler
381391

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
The :code:`INT` opcode of the C accelerator :mod:`_pickle` module was updated to look only for "00" and "01" to push booleans onto the stack, aligning with the Python :mod:`pickle` module.
1+
The :code:`INT` opcode of the C accelerator `_pickle` module was updated to look only for "00" and "01" to push booleans onto the stack, aligning with the Python :mod:`pickle` module.

0 commit comments

Comments
 (0)