-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Open
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
When the STOP
opcode is encountered in pickletools, a check is made to see if there's anything left on the stack, and an error is thrown if there is.
Lines 2542 to 2543 in 5414b97
if stack: | |
raise ValueError("stack not empty after STOP: %r" % stack) |
However, both C and Python versions of the Unpickler don't make these checks and don't care how many items are left on the stack afterwards, as long as there's something for them to return.
In addition, C and Python versions of pickle don't care if a MARK
opcode is still present or it's inside a metastack or whatnot, but since pickletools treats MARK
as an object on the stack, it will also error out if a pickled bytestream like b'(K\x01.'
is presented:
pickletools:
0: ( MARK
1: K BININT1 1
3: . STOP
highest protocol among opcodes = 1
pickletools failed stack not empty after STOP: [mark]
CPython versions tested on:
3.11
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
Status
No status