Skip to content

_xxsubinterpreters: the name of shared exception type is str(exc_type), not exc_type.__name__ #105873

@chgnrdv

Description

@chgnrdv

Example:

>> import _xxsubinterpreters
>> i = _xxsubinterpreters.create()
>> _xxsubinterpreters.run_string(i, "(")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
_xxsubinterpreters.RunFailedError: <class 'SyntaxError'>: '(' was never closed (<string>, line 1)

It happens because in _sharedexception_bind %S format specifier is used and exception type is passed to PyUnicode_FromFormat, i. e. PyObject_Str is called on exception type in order to get its name:

PyObject *nameobj = PyUnicode_FromFormat("%S", Py_TYPE(exc));

I'll send a PR soon.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions