Title: multiprocessing.sharedctypes: SynchronizedBase calls get_context(force=True), which raises TypeError · Issue #156062 · python/cpython · GitHub
Open Graph Title: multiprocessing.sharedctypes: SynchronizedBase calls get_context(force=True), which raises TypeError · Issue #156062 · python/cpython
X Title: multiprocessing.sharedctypes: SynchronizedBase calls get_context(force=True), which raises TypeError · Issue #156062 · python/cpython
Description: Bug report Bug description: multiprocessing.sharedctypes.SynchronizedBase.__init__ calls get_context(force=True) when it is given neither a lock nor a ctx: https://github.com/python/cpython/blob/20e6c2fc7c9fe5a8d62aa8f1b66a1bd72a24cf74/L...
Open Graph Description: Bug report Bug description: multiprocessing.sharedctypes.SynchronizedBase.__init__ calls get_context(force=True) when it is given neither a lock nor a ctx: https://github.com/python/cpython/blob/20...
X Description: Bug report Bug description: multiprocessing.sharedctypes.SynchronizedBase.__init__ calls get_context(force=True) when it is given neither a lock nor a ctx: https://github.com/python/cpython/blob/20...
Opengraph URL: https://github.com/python/cpython/issues/156062
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"multiprocessing.sharedctypes: SynchronizedBase calls get_context(force=True), which raises TypeError","articleBody":"# Bug report\n\n### Bug description:\n\n`multiprocessing.sharedctypes.SynchronizedBase.__init__` calls `get_context(force=True)` when it is given neither a `lock` nor a `ctx`:\n\nhttps://github.com/python/cpython/blob/20e6c2fc7c9fe5a8d62aa8f1b66a1bd72a24cf74/Lib/multiprocessing/sharedctypes.py#L187-L193\n\nBut `get_context()` has never accepted a `force` argument (`set_start_method()` does), so constructing one of the synchronized wrapper classes directly, without a lock or a context, fails:\n\n```python\n>>> from multiprocessing.sharedctypes import RawValue, Synchronized\n>>> Synchronized(RawValue('i', 7))\nTraceback (most recent call last):\n File \"\u003cpython-input-1>\", line 1, in \u003cmodule>\n Synchronized(RawValue('i', 7))\n ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^\n File \".../multiprocessing/sharedctypes.py\", line 192, in __init__\n ctx = ctx or get_context(force=True)\nTypeError: DefaultContext.get_context() got an unexpected keyword argument 'force'\n```\n\nThe same applies to `SynchronizedArray` and `SynchronizedString`. The module-level helpers (`Value()`, `Array()`, `synchronized()`) are not affected because they always resolve a context themselves and pass it down, which is why this has gone unnoticed: the line dates from the commit that introduced contexts (b1694cf588, bpo-18999, 2013).\n\nThe fix is to call `get_context()` without the bogus argument, which is what `synchronized()` does a few lines above. Found by running pylint over the standard library (`unexpected-keyword-arg`). I have a PR with a regression test ready.\n\n### CPython versions tested on:\n\n3.14, CPython main branch\n\n### Operating systems tested on:\n\nmacOS\n\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-156063\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/ekanshul","@type":"Person","name":"ekanshul"},"datePublished":"2026-08-19T17:28:20Z","url":"https://github.com/python/cpython/issues/156062"}
| 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:f3db7bd0-9143-f32d-60fc-5471d5993d37 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 95AC:2AF0D8:F91D5B:137C7FB:6B02384A |
| html-safe-nonce | 4cca574499f2cd48b66f7075d830a16cd799879892e285b1d19b7a8c3029a5ae |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NUFDOjJBRjBEODpGOTFENUI6MTM3QzdGQjo2QjAyMzg0QSIsInZpc2l0b3JfaWQiOiI3MjAyNTc5MzI1OTAyNzk2ODc0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 1af655b663987f071579044a16805f48d4a1535f18511fe11eec303102f7dec6 |
| hovercard-subject-tag | issue:5195389654 |
| 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/156062/issue_layout |
| twitter:image | https://opengraph.githubassets.com/77efa7737c7ad27e19b2f7b9a5be4ee98d85aac330998df6eb120892abea70c0/python/cpython/issues/156062 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/77efa7737c7ad27e19b2f7b9a5be4ee98d85aac330998df6eb120892abea70c0/python/cpython/issues/156062 |
| og:image:alt | Bug report Bug description: multiprocessing.sharedctypes.SynchronizedBase.__init__ calls get_context(force=True) when it is given neither a lock nor a ctx: https://github.com/python/cpython/blob/20... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ekanshul |
| 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