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

[3.12] Crash of repeatedPrograms/_testembed.c on Windows DEBUG build #128833

Closed
Labels
3.12only security fixesOS-windowsinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errortype-crashA hard crash of the interpreter, possibly with a core dump
@picnixz

Description

@picnixz

Bug report

Bug description:

This is an issue that only affects Windows DEBUG builds and Python 3.12. I discovered it while writing#127780 and@Yhg1s (#127780 (comment)) investigated it more in details.

The reproducer is as follows:

PS D:\Python\cpython> D:\\Python\\cpython\\PCbuild\\amd64\\_testembed_d.exe test_repeated_init_exec'import dis>> import importlib._bootstrap>> import opcode>> import test.test_dis>>>> def is_specialized(f):>>     for instruction in dis.get_instructions(f, adaptive=True):>>         opname = instruction.opname>>         if (>>             opname in opcode._specialized_instructions>>             # Exclude superinstructions:>>             and \"__\" not in opname>>         ):>>             return True>>     return False>>>> func = importlib._bootstrap._handle_fromlist>>>> # "copy" the code to un-specialize it:>> func.__code__ = func.__code__.replace()>>>> assert not is_specialized(func), \"specialized instructions found\">>>> for i in range(test.test_dis.ADAPTIVE_WARMUP_DELAY):>>     func(importlib._bootstrap, [\"x\"], lambda *args: None)>>>> assert is_specialized(func), \"no specialized instructions found\">>>> print(\"Tests passed\")'--- Loop#1 ---Tests passed--- Loop#2 ---Assertion failed: PyUnicode_CheckExact(ep->me_key), file D:\Python\cpython\Objects\dictobject.c, line939

Paraphrasing Thomas, the assertion failure happens only thesecond time, namely after finalizing and reinitializing, and theep the assertion fails on is a deallocated object. We suspect that something isn't refcounted correctly, isn't marked as immortal when it should be, or isn't recreated on interpreter starutp when it should be. However, we don't why the issue does not appear on Linux.

According to Thomas, this is likely an issue with repeated calls toPy_Finalize andPy_Initialize. However, since 3.12 and 3.13 manage objects lifetime quite differently, it might be easier to just patch the test currently failing as follows:68a33f3.

CPython versions tested on:

3.12

Operating systems tested on:

Windows, Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixesOS-windowsinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errortype-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp