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

Annotation scopes containing nested scopes #109118

Closed
Assignees
JelleZijlstra
Labels
3.13bugs and security fixestype-bugAn unexpected behavior, bug, or error
@15r10nk

Description

@15r10nk

Bug report

Bug description:

The following code causes a SystemError during compilation.

classname_2[*name_5,name_3:int]:    (name_3:=name_4)classname_4[name_5:name_5]((name_4forname_5inname_0ifname_3),name_2ifname_3elsename_0):pass

output (Python 3.12.0rc2+):

SystemError:compiler_lookup_arg(name='name_3')withreftype=3failedin<genericparametersofname_4>;freevarsofcode<genexpr>: ('name_3',)

removing the named-expression makes it worse and causes a crash

classname_2[*name_5,name_3:int]:classname_4[name_5:name_5]((name_4forname_5inname_0ifname_3),name_2ifname_3elsename_0):pass

output (Python 3.12.0rc2+):

Traceback (mostrecentcalllast):File"/home/frank/projects/pysource-codegen/bug2.py",line2,in<module>classname_2[*name_5,name_3:int]:File"/home/frank/projects/pysource-codegen/bug2.py",line2,in<genericparametersofname_2>classname_2[*name_5,name_3:int]:File"/home/frank/projects/pysource-codegen/bug2.py",line4,inname_2classname_4[name_5:name_5]((name_4forname_5inname_0ifname_3),name_2ifname_3elsename_0):File"/home/frank/projects/pysource-codegen/bug2.py",line4,in<genericparametersofname_4>classname_4[name_5:name_5]((name_4forname_5inname_0ifname_3),name_2ifname_3elsename_0):^^^^^^NameError:name'name_0'isnotdefinedModules/gcmodule.c:113:gc_decref:Assertion"gc_get_refs(g) > 0"failed:refcountistoosmallEnabletracemalloctogetthememoryblockallocationtracebackobjectaddress  :0x7f4c77059a30objectrefcount :1objecttype     :0x560ea4b6cfe0objecttypename:dictobjectrepr     : {'__module__':'__main__','__qualname__':'name_2','__type_params__': (name_5,name_3)}FatalPythonerror:_PyObject_AssertFailed:_PyObject_AssertFailedPythonruntimestate:finalizing (tstate=0x0000560ea4cc9ba0)Currentthread0x00007f4c7756c280 (mostrecentcallfirst):Garbage-collecting<noPythonframe>

side note:
The reason for the strange looking language constructs and variable names is that I generated this code. I found it while working on my pysource-codegen library.

CPython versions tested on:

3.12

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

Labels

3.13bugs and security fixestype-bugAn unexpected behavior, bug, or error

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp