Title: Struct.__init__() can leave the Struct object in inconsistent state · Issue #145743 · python/cpython · GitHub
Open Graph Title: Struct.__init__() can leave the Struct object in inconsistent state · Issue #145743 · python/cpython
X Title: Struct.__init__() can leave the Struct object in inconsistent state · Issue #145743 · python/cpython
Description: Since Struct.__init__() first saves the format in s_format, then sets s_code used to pack/unpack, after calling it with invalid format argument it leaves the Struct object in inconsistent state -- format returns the new (invalid) format,...
Open Graph Description: Since Struct.__init__() first saves the format in s_format, then sets s_code used to pack/unpack, after calling it with invalid format argument it leaves the Struct object in inconsistent state -- ...
X Description: Since Struct.__init__() first saves the format in s_format, then sets s_code used to pack/unpack, after calling it with invalid format argument it leaves the Struct object in inconsistent state -- ...
Opengraph URL: https://github.com/python/cpython/issues/145743
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Struct.__init__() can leave the Struct object in inconsistent state","articleBody":"Since `Struct.__init__()` first saves the format in `s_format`, then sets `s_code` used to pack/unpack, after calling it with invalid format argument it leaves the Struct object in inconsistent state -- `format` returns the new (invalid) format, while packing/unpacking use old format (if it was set). This happens only when call it explicitly, which will be deprecated (see #143715). If simply call `Struct()` with invalid argument, you will not get a broken object, you will get an error.\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-145744\n* gh-145763\n* gh-145764\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/serhiy-storchaka","@type":"Person","name":"serhiy-storchaka"},"datePublished":"2026-03-10T12:25:43Z","url":"https://github.com/python/cpython/issues/145743"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| 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:ff4b3c5b-2252-b076-07db-2f35d60dc436 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AFAA:39FD06:3C6031:52DB67:6AECCDA5 |
| html-safe-nonce | 19465a7233caa746f1a5458d4e072f2f9796034df64c474647473f273c47600c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRkFBOjM5RkQwNjozQzYwMzE6NTJEQjY3OjZBRUNDREE1IiwidmlzaXRvcl9pZCI6IjMzODAyNzM1MzMwMTM1MTE1ODkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4c01a2dfb3b0a1f398ff7017d28b1344ca7aec936907de69c7bfc4147cd88a37 |
| hovercard-subject-tag | issue:4051449589 |
| 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/145743/issue_layout |
| twitter:image | https://opengraph.githubassets.com/24d5d3b31b9a8a5276e4f489a1f48e7dc01e0804dbe4246cfdd3173e9a5954e9/python/cpython/issues/145743 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/24d5d3b31b9a8a5276e4f489a1f48e7dc01e0804dbe4246cfdd3173e9a5954e9/python/cpython/issues/145743 |
| og:image:alt | Since Struct.__init__() first saves the format in s_format, then sets s_code used to pack/unpack, after calling it with invalid format argument it leaves the Struct object in inconsistent state -- ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | serhiy-storchaka |
| hostname | github.com |
| expected-hostname | github.com |
| None | dc0b519c5798dc1150b88dc4c06a8b9634d0069218dc04e469970e76aad74016 |
| 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 | db139f0bf57b59bf9a8c4abb0849924d6c6ca559 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width