Title: SystemExit.code is read-only; CPython allows assignment · Issue #8230 · RustPython/RustPython · GitHub
Open Graph Title: SystemExit.code is read-only; CPython allows assignment · Issue #8230 · RustPython/RustPython
X Title: SystemExit.code is read-only; CPython allows assignment · Issue #8230 · RustPython/RustPython
Description: Summary SystemExit.code is read-only in RustPython, but it is a writable member in CPython: class MyExit(SystemExit): pass m = MyExit(1) m.code = 42 # AttributeError: attribute 'code' of 'MyExit' objects is not writable CPython 3.14.2 ac...
Open Graph Description: Summary SystemExit.code is read-only in RustPython, but it is a writable member in CPython: class MyExit(SystemExit): pass m = MyExit(1) m.code = 42 # AttributeError: attribute 'code' of 'MyExit' o...
X Description: Summary SystemExit.code is read-only in RustPython, but it is a writable member in CPython: class MyExit(SystemExit): pass m = MyExit(1) m.code = 42 # AttributeError: attribute 'code' of ...
Opengraph URL: https://github.com/RustPython/RustPython/issues/8230
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"SystemExit.code is read-only; CPython allows assignment","articleBody":"# Summary\n\n`SystemExit.code` is read-only in RustPython, but it is a writable member in CPython:\n\n```python\nclass MyExit(SystemExit):\n pass\n\nm = MyExit(1)\nm.code = 42\n# AttributeError: attribute 'code' of 'MyExit' objects is not writable\n```\n\nCPython 3.14.2 accepts the assignment (`code` is a `PyMemberDef` on `SystemExit`, i.e. a writable data descriptor; same as assigning on `SystemExit` itself). Verified on `main` @ 7044fdcc8.\n\nNote the neighboring exception members are already correct — e.g. `OSError().errno = 5` works — it's specifically `SystemExit.code` that was made read-only.\n\n# Cause\n\n`crates/vm/src/exceptions.rs:965`:\n\n```rust\n\"code\" =\u003e ctx.new_readonly_getset(\"code\", excs.system_exit, system_exit_code),\n```\n\nShould be a getset with a setter (or member-style storage) writing through to the instance, like the `errno`/`filename`/etc. attributes on `OSError`. `sys.exit()`/`SystemExit.__init__` derive `code` from `args`, and CPython keeps `code` as an independent writable slot after construction.\n\n---\n*Found while running synthetic benchmark/compat suites; researched and reported by Claude on behalf of @youknowone.*\n","author":{"url":"https://github.com/youknowone","@type":"Person","name":"youknowone"},"datePublished":"2026-07-06T15:34:35.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/8230/RustPython/issues/8230"}
| 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:736a9d72-771c-7fd1-ab9a-92eef4c340ad |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A64E:4B803:1CF8F11:26CE7DB:6A597AEE |
| html-safe-nonce | a0aab778b5408af3df89f07cf2571d248a1e62b85a59235d15671f3913f79a20 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjRFOjRCODAzOjFDRjhGMTE6MjZDRTdEQjo2QTU5N0FFRSIsInZpc2l0b3JfaWQiOiI4MzM2MzExMzExNzU3MDQ4NTU4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 26500eda8d258d31091c2876337aa2e9acdacad845ffc5b10e1687711b5a9fe9 |
| hovercard-subject-tag | issue:4820664200 |
| 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/RustPython/RustPython/8230/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6243052f6fa6b24837c286910d71d889e2c3b73dc2538bab53f9c259a05240ee/RustPython/RustPython/issues/8230 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6243052f6fa6b24837c286910d71d889e2c3b73dc2538bab53f9c259a05240ee/RustPython/RustPython/issues/8230 |
| og:image:alt | Summary SystemExit.code is read-only in RustPython, but it is a writable member in CPython: class MyExit(SystemExit): pass m = MyExit(1) m.code = 42 # AttributeError: attribute 'code' of 'MyExit' o... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | youknowone |
| hostname | github.com |
| expected-hostname | github.com |
| None | a540949572872b935b393b36db38922db390ae71c859537d741b8f3eb7e545b5 |
| turbo-cache-control | no-preview |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| 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 | 624bb50a7497aa346bef8cc3743af408a9ea10ca |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width