Title: `_interpreters.set___main___attrs` raises SystemError when passed a non-dict object · Issue #135855 · python/cpython · GitHub
Open Graph Title: `_interpreters.set___main___attrs` raises SystemError when passed a non-dict object · Issue #135855 · python/cpython
X Title: `_interpreters.set___main___attrs` raises SystemError when passed a non-dict object · Issue #135855 · python/cpython
Description: Bug report Bug description: This snippet: import _interpreters import types i = _interpreters.create() _interpreters.set___main___attrs(i, types.MappingProxyType({"a": 1})) raises: Traceback (most recent call last): File "/home/brian/Pro...
Open Graph Description: Bug report Bug description: This snippet: import _interpreters import types i = _interpreters.create() _interpreters.set___main___attrs(i, types.MappingProxyType({"a": 1})) raises: Traceback (most ...
X Description: Bug report Bug description: This snippet: import _interpreters import types i = _interpreters.create() _interpreters.set___main___attrs(i, types.MappingProxyType({"a": 1})) raises: Traceb...
Opengraph URL: https://github.com/python/cpython/issues/135855
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`_interpreters.set___main___attrs` raises SystemError when passed a non-dict object","articleBody":"# Bug report\n\n### Bug description:\n\nThis snippet:\n```python\nimport _interpreters\nimport types\n\ni = _interpreters.create()\n_interpreters.set___main___attrs(i, types.MappingProxyType({\"a\": 1}))\n```\nraises:\n```python-traceback\nTraceback (most recent call last):\n File \"/home/brian/Projects/open-contrib/cpython/temp.py\", line 27, in \u003cmodule>\n _interpreters.set___main___attrs(i, types.MappingProxyType({\"a\": 1}))\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nSystemError: Objects/dictobject.c:4162: bad argument to internal function\n```\n\nThis happens during [this call](https://github.com/python/cpython/blob/b3ae76911df465ade76c267c5fa2a02cf1138b48/Modules/_interpretersmodule.c#L1075) to `_PyXI_Enter` which calls `PyDict_Size` on `updates`.\n\nThe [public interface](https://github.com/python/cpython/blob/b3ae76911df465ade76c267c5fa2a02cf1138b48/Lib/concurrent/interpreters/__init__.py#L193-L194) always passes a `dict`, and other paths that call `_PyXI_Enter` check for an actual dict (e.g., [`exec`](https://github.com/python/cpython/blob/b3ae76911df465ade76c267c5fa2a02cf1138b48/Modules/_interpretersmodule.c#L1123-L1126)). I think it makes sense to do the same thing here. PR forthcoming. \n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-135856\n* gh-135900\n* gh-135903\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/brianschubert","@type":"Person","name":"brianschubert"},"datePublished":"2025-06-23T14:16:43Z","url":"https://github.com/python/cpython/issues/135855"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0e39c6f2-328b-9b73-5e6c-5596fdaf40f8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BA68:1AB47A:2BFFA2:3A725C:6B023350 |
| html-safe-nonce | 4b48e7ca57e060493559bc7092a432e62f1acd98d87b59cb94b271a867f3bbb2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQTY4OjFBQjQ3QToyQkZGQTI6M0E3MjVDOjZCMDIzMzUwIiwidmlzaXRvcl9pZCI6IjEzNTk1NzI3OTI2OTczMDM4ODgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | e1245cc0780b7a5b7216ed04f78c70ae465eec2f117f15adf343993c8e34dfff |
| hovercard-subject-tag | issue:3168373633 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/135855/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6850784ada892dbc3c19c6e7a5ce32865d08491ce4a66f12192d3b651f2f1f4e/python/cpython/issues/135855 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6850784ada892dbc3c19c6e7a5ce32865d08491ce4a66f12192d3b651f2f1f4e/python/cpython/issues/135855 |
| og:image:alt | Bug report Bug description: This snippet: import _interpreters import types i = _interpreters.create() _interpreters.set___main___attrs(i, types.MappingProxyType({"a": 1})) raises: Traceback (most ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | brianschubert |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width