Title: TextIOWrapper.reconfigure() crashes if encoding is not string or None · Issue #111942 · python/cpython · GitHub
Open Graph Title: TextIOWrapper.reconfigure() crashes if encoding is not string or None · Issue #111942 · python/cpython
X Title: TextIOWrapper.reconfigure() crashes if encoding is not string or None · Issue #111942 · python/cpython
Description: Crash report What happened? Unlike to TextIOWrapper constructor, TextIOWrapper.reconfigure() does not check that the encoding argument is actually None or string. If it is not None, it calls _PyUnicode_EqualToASCIIString that only works ...
Open Graph Description: Crash report What happened? Unlike to TextIOWrapper constructor, TextIOWrapper.reconfigure() does not check that the encoding argument is actually None or string. If it is not None, it calls _PyUni...
X Description: Crash report What happened? Unlike to TextIOWrapper constructor, TextIOWrapper.reconfigure() does not check that the encoding argument is actually None or string. If it is not None, it calls _PyUni...
Opengraph URL: https://github.com/python/cpython/issues/111942
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TextIOWrapper.reconfigure() crashes if encoding is not string or None","articleBody":"# Crash report\n\n### What happened?\n\nUnlike to `TextIOWrapper` constructor, `TextIOWrapper.reconfigure()` does not check that the encoding argument is actually None or string. If it is not None, it calls `_PyUnicode_EqualToASCIIString` that only works with strings and crashes in debug build. There may be other similar errors in other arguments.\n\n```pycon\n\u003e\u003e\u003e import sys\n\u003e\u003e\u003e sys.stdout.reconfigure(encoding=42)\nObjects/unicodeobject.c:552: _PyUnicode_CheckConsistency: Assertion failed: PyType_HasFeature((Py_TYPE(((PyObject*)((op))))), ((1UL \u003c\u003c 28)))\nEnable tracemalloc to get the memory block allocation traceback\n\nobject address : 0x55a2e3147ca8\nobject refcount : 4294967295\nobject type : 0x55a2e3119f00\nobject type name: int\nobject repr : 42\n\nFatal Python error: _PyObject_AssertFailed: _PyObject_AssertFailed\nPython runtime state: initialized\n\nCurrent thread 0x00007fc99ee43740 (most recent call first):\n File \"\u003cstdin\u003e-1\", line 1 in \u003cmodule\u003e\nAborted (core dumped)\n```\n\n\n### CPython versions tested on:\n\n3.10, 3.11, 3.12\n\n### Operating systems tested on:\n\n_No response_\n\n### Output from running 'python -VV' on the command line:\n\n_No response_\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-111976\n* gh-112058\n* gh-112059\n* gh-112061\n* gh-112067\n* gh-112085\n* gh-112089\n* gh-126542\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/serhiy-storchaka","@type":"Person","name":"serhiy-storchaka"},"datePublished":"2023-11-10T10:23:22.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/111942/cpython/issues/111942"}
| 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:548c4bee-d8f8-9f5f-8b3a-853bc9e812d3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 84BE:21AC08:109FD0F:16EB7FD:696A95DB |
| html-safe-nonce | 7e65ebdc638f39e2e385f3f08430ffc72aa2e0347fc40c19b6283f1ffe4b78bb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NEJFOjIxQUMwODoxMDlGRDBGOjE2RUI3RkQ6Njk2QTk1REIiLCJ2aXNpdG9yX2lkIjoiMjEwNDkzODg4NDg1MDQyMzI1OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | fc53e8c81017b587433e20106d0c93c92262d6bd10184962f896d4480629ac80 |
| hovercard-subject-tag | issue:1987344123 |
| 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/111942/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b5af8954b3e694049cd56e3e7f8e9fcedd16a0995206dde06896bd04a37fbdf7/python/cpython/issues/111942 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b5af8954b3e694049cd56e3e7f8e9fcedd16a0995206dde06896bd04a37fbdf7/python/cpython/issues/111942 |
| og:image:alt | Crash report What happened? Unlike to TextIOWrapper constructor, TextIOWrapper.reconfigure() does not check that the encoding argument is actually None or string. If it is not None, it calls _PyUni... |
| 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 | 4dd496afc954da9c207b2d9fbe86e3074619f565754aa1d9274aec30d9e5b8d7 |
| 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 | 31496a13b80a2f6ad77d6c617ee2255a3545b539 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width