Title: SystemError in io.BufferedWriter.close when closed errors · Issue #140650 · python/cpython · GitHub
Open Graph Title: SystemError in io.BufferedWriter.close when closed errors · Issue #140650 · python/cpython
X Title: SystemError in io.BufferedWriter.close when closed errors · Issue #140650 · python/cpython
Description: Bug report Bug description: import io class MockRawIO: def __init__(self): self.closed = NotImplemented def write(self, b): return len(data) def writable(self): return True tp = io.BufferedWriter writer = MockRawIO() bufio = tp(writer, 8...
Open Graph Description: Bug report Bug description: import io class MockRawIO: def __init__(self): self.closed = NotImplemented def write(self, b): return len(data) def writable(self): return True tp = io.BufferedWriter w...
X Description: Bug report Bug description: import io class MockRawIO: def __init__(self): self.closed = NotImplemented def write(self, b): return len(data) def writable(self): return True tp = io.BufferedWriter w...
Opengraph URL: https://github.com/python/cpython/issues/140650
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"SystemError in io.BufferedWriter.close when closed errors","articleBody":"# Bug report\n\n### Bug description:\n\n```python\nimport io\n\nclass MockRawIO:\n def __init__(self):\n self.closed = NotImplemented\n def write(self, b):\n return len(data)\n def writable(self):\n return True\n\ntp = io.BufferedWriter\nwriter = MockRawIO()\nbufio = tp(writer, 8)\nbufio.close()\n```\n\n```\nSystemError: \u003cmethod 'close' of '_io.BufferedWriter' objects> returned a result with an exception set\n```\n\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-140653\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/YuanchengJiang","@type":"Person","name":"YuanchengJiang"},"datePublished":"2025-10-27T02:51:20Z","url":"https://github.com/python/cpython/issues/140650"}
| 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:6934064f-a757-325c-5371-f14494136129 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A9FC:B53AF:3510750:46A3303:6B020194 |
| html-safe-nonce | 032d7d045550d16b2a9c5deddc70e7d2d373f7abc1a08021c0aac2a3f9b62970 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOUZDOkI1M0FGOjM1MTA3NTA6NDZBMzMwMzo2QjAyMDE5NCIsInZpc2l0b3JfaWQiOiI5MTg5MzA0NTY4NTExNTk0OTAxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | e1c429b577a79d7b9e088532bbb5ecbc700eabcdcaaf6483cbb41e9d3aa04c2f |
| hovercard-subject-tag | issue:3554836268 |
| 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/140650/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a74426e22f9692793e751fdb52320eed29f1f4a16aec65309118210746c58c3d/python/cpython/issues/140650 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a74426e22f9692793e751fdb52320eed29f1f4a16aec65309118210746c58c3d/python/cpython/issues/140650 |
| og:image:alt | Bug report Bug description: import io class MockRawIO: def __init__(self): self.closed = NotImplemented def write(self, b): return len(data) def writable(self): return True tp = io.BufferedWriter w... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | YuanchengJiang |
| 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