Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Crash report
What happened?
It's possible to make the interpreter abort by calling_interpreters.run_string with an instance of a subclass ofstr as thescript argument:
import_interpretersclassweird_str(str):pass_interpreters.create()_interpreters.run_string(1,weird_str('1'))python: ./Modules/_interpretersmodule.c:333:get_code_str:Assertion `PyUnicode_CheckExact(arg)&& (check_code_str((PyUnicodeObject*)arg)==NULL)'failed.Aborted (coredumped)
This happens because, after a check thatarg is astr or subclass, there's an assertion thatarg is exactly an instance ofstr:
if (PyUnicode_Check(arg)) {assert(PyUnicode_CheckExact(arg)&& (check_code_str((PyUnicodeObject*)arg)==NULL));
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
Python 3.14.0a6+ (heads/main:04bc681e7cf, Apr 4 2025, 12:38:19) [GCC 11.4.0]
Linked PRs
Metadata
Metadata
Assignees
Labels
Projects
Status
Done