Skip to content

pickletools.dis() doesn't allow redefinition of memo items while pickle itself doesn't mind #123309

Closed
@birkenfeld

Description

@birkenfeld

Bug report

Bug description:

pickletools' disassembler has a check here that doesn't allow memo indices to be redefined, while the pickle.Unpickler doesn't care about it, an existing item is handled without complaint here. FWIW, the opcode doc doesn't mention a restriction either.

Such pickles aren't produced by the Pickler, but it is strange for a debug tool to be more restrictive than the thing it is supposed to help debug. (I found this while fuzzing a non-Python unpickling library.) I think the check in pickletools L2497 can just be removed. A warning could also be emitted, but that would be the first such warning in pickletools.

CPython versions tested on:

3.12

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and security fixesstdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions