Skip to content

Add more tests for pickle and fix error messages #122311

Closed
@serhiy-storchaka

Description

@serhiy-storchaka

Bug report

Much error generating code in the pickle module is not tested at all. As result, not only exception types and messages can differ between Python and C implementations, but other bugs are left unnoticed:

  • NameError in formatting one of error messages.
  • "Can't pickle" in the error message during unpickling.
  • Error message including the repr of wrong object.
  • Some errors are only detected in one of implementations (Python or C).
  • Crash in untested corner case (Crash after error in PickleBuffer #122306).

I am going to add more tests and fix the most odious errors. This will be backported to 3.12 and 3.13, but the backport to 3.12 will have more lenient variants of tests. Late, I will unify and improve other error messages (this is for main only).

Linked PRs

Metadata

Metadata

Labels

3.12only security fixes3.13bugs and security fixes3.14bugs and security fixestestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions