Skip to content

No attribute error when writing to a builtin defined in builtins.pyi #4607

Description

@Wizzerinus

Describe the Bug

With the following files:

~/t/pyrefly_builtins $ cat test.py                                             
import builtins
print(globalVar)
builtins.globalVar=1

~/t/pyrefly_builtins $ cat __builtins__.pyi                               
globalVar: int

globalVar is correctly inferred as an int in the second line, but the third line emits an error

Sandbox Link

https://pyrefly.org/sandbox/?project=v2.pZRBDoQgDEWv0sQFOzuz9RRzgNngjEESIkbQ8_spYqKJbtwWWsp_7b-yzG3z2tm6iDlJsmd5jfOtdnAtQVHO6z2MLt8v6e-kTkWfHKDtIfgCZDUz3Ady1d-hgvF01Mc4hoa5pPvJcDfw3_8CHzKY0iDoRVvxtGM58kIzoOwTLCpTUXdQVGKCG0KhCCIkLL69C9NgXOMtixU

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions