Open
Description
Bug report
Bug description:
A lot of Python code tolerates leading and trailing whitespace in string-to-number conversions. However, in the FLOAT
opcode of pickle, the Python implementation can tolerate leading/trailing whitespace, while the C implementation throws an error and can't convert it. Note that the INT
opcode can gracefully handle leading/trailing whitespace (in both Python and C).
Payloads:
payload: b'F 5\n.'
pickle: 5.0
_pickle.c: FAILURE could not convert string to float: ' 5
'
pickletools:
0: F FLOAT 5.0
4: . STOP
highest protocol among opcodes = 0
payload: b'F5 \n.'
pickle: 5.0
_pickle.c: FAILURE could not convert string to float
pickletools:
0: F FLOAT 5.0
4: . STOP
highest protocol among opcodes = 0
payload: b'I 5 \n.'
pickle: 5
_pickle.c: 5
pickletools:
0: I INT 5
5: . STOP
highest protocol among opcodes = 0
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Projects
Status
No status