Traceback (most recent call last):
File "/home/brian/Projects/open-contrib/cpython/temp.py", line 27, in <module>
_interpreters.set___main___attrs(i, types.MappingProxyType({"a": 1}))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^SystemError: Objects/dictobject.c:4162: bad argument to internal function
This happens during this call to _PyXI_Enter which calls PyDict_Size on updates.
The public interface always passes a dict, and other paths that call _PyXI_Enter check for an actual dict (e.g., exec). I think it makes sense to do the same thing here. PR forthcoming.
changed the title [-]`_interpreters.set___main___attrs` raises SystemError was passed a non-dict object[/-][+]`_interpreters.set___main___attrs` raises SystemError when passed a non-dict object[/+]on Jun 23, 2025
Activity
gh-135855: Raise TypeError When Passing Non-dict Object to `_interpre…
pythongh-135855: Raise TypeError When Passing Non-dict Object to `_in…
[3.14] gh-135855: Raise TypeError When Passing Non-dict Object to `_i…
[3.13] pythongh-135855: Raise TypeError When Passing Non-dict Object …
[3.13] gh-135855: Raise TypeError When Passing Non-dict Object to `_i…
pythongh-135855: Raise TypeError When Passing Non-dict Object to `_in…
pythongh-135855: Raise TypeError When Passing Non-dict Object to `_in…
pythongh-135855: Raise TypeError When Passing Non-dict Object to `_in…
pythongh-135855: Raise TypeError When Passing Non-dict Object to `_in…