You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SystemExit.code is read-only; CPython allows assignment #8230
SystemExit.code is read-only in RustPython, but it is a writable member in CPython:
classMyExit(SystemExit):
passm=MyExit(1)
m.code=42# AttributeError: attribute 'code' of 'MyExit' objects is not writable
CPython 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 @ 7044fdc.
Note the neighboring exception members are already correct — e.g. OSError().errno = 5 works — it's specifically SystemExit.code that was made read-only.
Should 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.
Found while running synthetic benchmark/compat suites; researched and reported by Claude on behalf of @youknowone.
Activity
kangdora commentedon Jul 12, 2026
take