Skip to content

Python 3.13 new __firstlineno__ class attribute #9484

@koutoftimer

Description

@koutoftimer

python/cpython#118465 introduces new class attribute __firstlineno__, which pyright doesn't support.

An example code work fine in python3.13 runtime

class A: ...


print(f"{A.__firstlineno__=}")

but pyright shows an error

:!pyright run.py                                                                                         
                                                                                                         
/tmp/tmp.A9F2mvqmhp/run.py                                                                               
  /tmp/tmp.A9F2mvqmhp/run.py:4:12 - error: Cannot access attribute "__firstlineno__" for class "type[A]" 
    Attribute "__firstlineno__" is unknown (reportAttributeAccessIssue)                                  
1 error, 0 warnings, 0 informations

I've been using pyright 1.1.389 via neovim/mason/pyright extension.

:!pyright --version                                                                                                                                                                                                
                                                                                                                                                                                                                   
pyright 1.1.389

Metadata

Metadata

Assignees

No one assigned

    Labels

    as designedNot a bug, working as intendedbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions