Skip to content

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

@chgnrdv

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

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