Skip to content

Pickletools doesn't error on EXT4 negative argument #127045

@Legoclones

Description

@Legoclones

Bug report

Bug description:

All extension codes must be positive (enforced when using copyreg.add_extension and in both pickle.py and _pickle.c implementations), but pickletools doesn't throw an error if EXT4 has a negative argument.

I can make a pull request to change the argument from int4 to uint4, but that means pickletools accepts extension codes that are 0x7fffffff or higher, while pickle.py and _pickle.c don't. I could also change those modules so they process the 4 bytes as unsigned also, if no one has any objections to that.

CPython versions tested on:

3.11

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions