pytype icon indicating copy to clipboard operation
pytype copied to clipboard

merge-pyi creates faulty TypeVars at the top of the file

Open strau0106 opened this issue 2 years ago • 2 comments

after running pytype and merge-pyi some files have a line like this at the top of the file _TXPDoc = TypeVar('_TXPDoc', bound=XPDoc)

Taking this as an example: The class XPDoc is only defined after this line thus when running the script it throws a NameError: name XPDoc isn't defined This happens to every script that gets this line at the top of the script putting it in qoutes removes the error and everything works fine...

I am unsure wether I am doing something wrong or it is pytype.

pytype version: 2023.04.18 python version: 3.10.6

strau0106 avatar Apr 21 '23 20:04 strau0106

I mean putting butting the bound argument in quotes like so bound='XPDoc'

strau0106 avatar Apr 22 '23 08:04 strau0106

this definitely sounds like a bug in merge-pyi, we ought to add the quotes to prevent this issue.

martindemello avatar Apr 22 '23 08:04 martindemello