Skip to content

Improve error handling when read marshal data #101006

Description

@serhiy-storchaka

There are several issues in error handling in the marshal module:

  1. EOFError can override other errors such as MemoryError or OSError at the start of the object.
  2. When the NULL object occurs as a code object component, the error message can be misleading (like "NULL object in marshal data for list") or even ignored (if the code object is a dict key) and reading will continue.

Also, it is a common idiom to only call PyErr_Occurred() if the return code denotes a possible error. This is not always used in that code. While the performance gain may be tiny, it is better to get rid of an overhead, it can pay for itself after further optimizations.

Linked PRs

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.10only security fixes3.11only security fixes3.12only security fixestype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions