Title: concurrent.interpreters.NotShareableError: object could not be unpickled · Issue #142572 · python/cpython · GitHub
Open Graph Title: concurrent.interpreters.NotShareableError: object could not be unpickled · Issue #142572 · python/cpython
X Title: concurrent.interpreters.NotShareableError: object could not be unpickled · Issue #142572 · python/cpython
Description: Bug report Bug description: Context: #142414 (comment) #142515 should fix the issue found in #142414. And during the time I was exploring the singleton removal, I found out it's possible, but the test may miss an edge case: from concurre...
Open Graph Description: Bug report Bug description: Context: #142414 (comment) #142515 should fix the issue found in #142414. And during the time I was exploring the singleton removal, I found out it's possible, but the t...
X Description: Bug report Bug description: Context: #142414 (comment) #142515 should fix the issue found in #142414. And during the time I was exploring the singleton removal, I found out it's possible, but t...
Opengraph URL: https://github.com/python/cpython/issues/142572
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"concurrent.interpreters.NotShareableError: object could not be unpickled","articleBody":"# Bug report\n\n### Bug description:\n\nContext:\n1. https://github.com/python/cpython/issues/142414#issuecomment-3639360631\n2. https://github.com/python/cpython/pull/142515 should fix the issue found in https://github.com/python/cpython/issues/142414.\n\nAnd during the time I was exploring the singleton removal, I found out it's possible, but the test may miss an edge case:\n\n```python\nfrom concurrent import interpreters \nfrom concurrent.interpreters import _queues as queues\nimport unittest\n\nclass Tests(unittest.TestCase):\n def test_cross_interpreter_unbound_identity(self):\n # Prepare shared queues.\n input_q = interpreters.create_queue()\n input_q.put(queues.UNBOUND)\n result_q = interpreters.create_queue()\n\n # Create a sub-interpreter.\n interp = interpreters.create()\n interp.prepare_main({\"input_q\": input_q, \"result_q\": result_q})\n\n # Run and compare the items in queue.\n interp.exec(\"\"\"\nfrom concurrent.interpreters import _queues as queues\nobj = input_q.get()\nis_identical = (obj is queues.UNBOUND)\nresult_q.put(is_identical)\n\"\"\")\n is_identical = result_q.get()\n self.assertTrue(is_identical, \"UNBOUND identity mismatch across interpreters\")\n\nif __name__ == \"__main__\":\n unittest.main()\n```\n\nThis test is failed without making the object picklable:\n\n```\nERROR: test_cross_interpreter_unbound_identity (__main__.Tests.test_cross_interpreter_unbound_identity)\n----------------------------------------------------------------------\nTraceback (most recent call last):\n File \"/usr/local/google/home/kirchou/lamdef/cpython/Lib/test/test_addd.py\", line 17, in test_cross_interpreter_unbound_identity\n interp.exec(\"\"\"\n ~~~~~~~~~~~^^^^\n from concurrent.interpreters import _queues as queues\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n ...\u003c2 lines\u003e...\n result_q.put(is_identical)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n \"\"\")\n ^^^^\n File \"/usr/local/google/home/kirchou/lamdef/cpython/Lib/concurrent/interpreters/__init__.py\", line 217, in exec\n raise ExecutionFailed(excinfo)\nconcurrent.interpreters.ExecutionFailed: concurrent.interpreters.NotShareableError: object could not be unpickled\n\nUncaught in the interpreter:\n\nTraceback (most recent call last):\n File \"/usr/local/google/home/kirchou/lamdef/cpython/Lib/concurrent/interpreters/_crossinterp.py\", line 65, in __new__\n raise Exception(f'use {cls._MODULE}.{cls._NAME}')\nException: use concurrent.interpreters._crossinterp.UNBOUND\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"\u003cscript\u003e\", line 3, in \u003cmodule\u003e\n File \"/usr/local/google/home/kirchou/lamdef/cpython/Lib/concurrent/interpreters/_queues.py\", line 261, in get\n obj, unboundop = _queues.get(self._id)\n ~~~~~~~~~~~^^^^^^^^^^\nconcurrent.interpreters.NotShareableError: object could not be unpickled\n```\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux","author":{"url":"https://github.com/note35","@type":"Person","name":"note35"},"datePublished":"2025-12-11T14:13:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/142572/cpython/issues/142572"}
| 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:4b2e8ec4-b6a2-783d-0acb-7a101ab0dc3d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C2A2:1D8CC3:1B14728:24CD3F2:6A5249DF |
| html-safe-nonce | a32aa13f35bef9cd838f94d882af1cf8a30548a38225e20bfc16c40addff3b7a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMkEyOjFEOENDMzoxQjE0NzI4OjI0Q0QzRjI6NkE1MjQ5REYiLCJ2aXNpdG9yX2lkIjoiNjQ0ODgzNTM0MTY1NDgzNzcyNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ef3c6fe95c39abeb45dc5a4e9f09186fc6bc6c30007a379188479cb3a0078c23 |
| hovercard-subject-tag | issue:3719579431 |
| 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/142572/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7c573519471ab5c4a0de1ef2ad43e26478757e3079a2a256edd7002f922edb10/python/cpython/issues/142572 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7c573519471ab5c4a0de1ef2ad43e26478757e3079a2a256edd7002f922edb10/python/cpython/issues/142572 |
| og:image:alt | Bug report Bug description: Context: #142414 (comment) #142515 should fix the issue found in #142414. And during the time I was exploring the singleton removal, I found out it's possible, but the t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | note35 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| 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 | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width