Skip to content

Assertion failure when marshalling buffer object with exception being set #106287

Description

@chgnrdv

Bisected to 33d95c6. Appears only on debug builds, otherwise passes silently.

import marshal
x = ({int}, memoryview(b''))
marshal.dumps(x)

Output:

Fatal Python error: _Py_CheckSlotResult: Slot getbuffer of type memoryview succeeded with an exception set
Python runtime state: initialized
ValueError: unmarshallable object

Current thread 0x00007f213ea12280 (most recent call first):
  File "/home/radislav/repro.py", line 22 in <module>
Aborted (core dumped)

In w_complex_object, when PyMarshal_WriteObjectToString is called on set item that is unmarshallable (int type in this case), an exception gets set on current tstate. Attempt to marshal next tuple item that is memoryview instance leads to call to PyObject_GetBuffer with exception being set.

I'll submit a PR.

Linked PRs

Activity

  1. added
    type-crashA hard crash of the interpreter, possibly with a core dump
    on Jun 30, 2023
  2. added a commit that references this issue on Apr 19, 2025
  3. added 2 commits that reference this issue on Jan 14, 2026
  4. added 2 commits that reference this issue on Jan 14, 2026
  5. added 2 commits that reference this issue on Jan 14, 2026
  6. added a commit that references this issue on Feb 15, 2026
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

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions