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

Unexpected name mangling behavior with generics #119311

Closed
Assignees
JelleZijlstra
Labels
3.12only security fixes3.13bugs and security fixes3.14bugs and security fixesrelease-blockertopic-typingtype-bugAn unexpected behavior, bug, or error
@gaesa

Description

@gaesa

Bug report

Bug description:

Name mangling behaves inconsistently when used with generics. Here’s the code to reproduce the issue:

class__Foo(type):passclassBar[T](metaclass=__Foo):pass

This raisesNameError: name '_Bar__Foo' is not defined. However, removing the[T] results in the error disappearing. This suggests that the name mangling behavior is inconsistent when generics are involved. This behavior seems to be a bug, as it would be expected for the name mangling to either always occur or never occur, regardless of whether generics are used.

CPython versions tested on:

3.12

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

Labels

3.12only security fixes3.13bugs and security fixes3.14bugs and security fixesrelease-blockertopic-typingtype-bugAn unexpected behavior, bug, or error

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp