Skip to content

gh-93627: Align Python implementation of pickle with C implementation of pickle#103035

Merged
serhiy-storchaka merged 45 commits intopython:mainfrom
eendebakpt:pickle_93627
Sep 10, 2023
Merged

gh-93627: Align Python implementation of pickle with C implementation of pickle#103035
serhiy-storchaka merged 45 commits intopython:mainfrom
eendebakpt:pickle_93627

Conversation

@eendebakpt
Copy link
Contributor

@eendebakpt eendebakpt commented Mar 25, 2023

In this PR we align the python and C implementation of pickle module. In this PR we have chosen to modify all implementations to follow the c implementation of pickle conventions: if a method like __reduce_ex_ or __reduce__ is set to None, a TypeError is raised.

Since the behaviour of the python and c implemenations is not equal, any PR aliging the two cannot be fully backwards compatible. The impact seems limited:

  • No changes are required to the tests (although a few tests are added to verify the new behaviour)
  • The changes impact cases that seem rare (e.g. setting the __reduce_ex__ attribute of a class to None, instead of creating a method)

Notes:

  • Changes to align the copy module have been removed from the PR.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stdlib Standard Library Python modules in the Lib/ directory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants