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

Initialize/Finalize Python multiple time and import datetime each time lead to a memory corruption #118608

Closed as not planned
Labels
type-crashA hard crash of the interpreter, possibly with a core dump
@neonene

Description

@neonene

Crash report

What happened?

Example on Windows (debug build):

# Taken from _ctypes issue: #116467importsubprocessprogram=r"PCbuild\amd64\_testembed_d.exe"cmd= [program,"test_repeated_init_exec","import datetime"]# or _datetimeforiinrange(1,11):print(f"   == Process #{i} ===")proc=subprocess.run(cmd)exitcode=proc.returncodeprint(f"=> exitcode{exitcode}")ifexitcode:breakprint()

Output (7bbce38: CI failures with a similar test):

Running Debug|x64 interpreter...   == Process #1 ===--- Loop #1 ------ Loop #2 ---Assertion failed: PyUnicode_CheckExact(ep_key), file C:\a\Objects\dictobject.c, line 1119=> exitcode 3

It is an expected error on a debug build, which comes form_PyUnicode_ClearInterned() inunicodeobject.c of the commitea2c001:

void_PyUnicode_ClearInterned(PyInterpreterState*interp){    .../* TODO:     * Currently, the runtime is not able to guarantee that it can exit without     * allocations that carry over to a future initialization of Python within     * the same process. i.e:     *   ./python -X showrefcount -c 'import itertools'     *   [237 refs, 237 blocks]     *     * Therefore, this should remain disabled for until there is a strict guarantee     * that no memory will be left after `Py_Finalize`.     */#ifdefPy_DEBUG    ...

Currently, release builds avoid thedatetime crash by leaking all interned strings. Both the crash and the leak should be fixed before shipping 3.13 final.


This dedicated issue is requested in:

CPython versions tested on:

3.12, CPython main branch

Operating systems tested on:

Linux, macOS, Windows

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-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