-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Description
The C implementation of pickle checks (partially explicitly, partially implicitly) the type and the range of the value returned by the extension registry. These checks are redundant in normal circumstances, because it is already checked in copyreg.add_extension() which is the only public interface for registering an extension. It is still worth to have some checks in the C code to prevent crash, undefined behavior or producing incorrect output in improbable situation (realistically, this can happen only if you broke the extension registry).
The Python implementation does not have explicit check. Broken extension registry will cause errors (with different type and message, but this is not important), except one case -- the code with the false boolean value (0, None, (), etc) -- in that case it produces output. Although, there is a difference when the code has __index__ method but is not int.
The following PR makes both implementations raising exception in the same circumstances (although the type of the exception may be different). The C checks are simplified. The Python check made more reliable.
Linked PRs
Metadata
Metadata
Assignees
Labels
Projects
Status