Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Assertion failure calling_interpreters.run_string with a string subclass instance #132171

Closed
Assignees
sobolevn
Labels
@devdanzin

Description

@devdanzin

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));

Found usingfusil by@vstinner.

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

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp