This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yanhao.charles
Recipients yanhao.charles
Date 2022-03-05.00:01:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1646438499.21.0.962171023528.issue46926@roundup.psfhosted.org>
In-reply-to
Content
As described in the doc: https://docs.python.org/3.8/library/runpy.html#runpy.run_path

> If the supplied path directly references a script file (whether as source or as precompiled byte code), then __file__ will be set to the supplied path, and __spec__, __cached__, __loader__ and __package__ will all be set to None.

But:
```
$ cat a.py
print(f'{__name__ = }')
print(f'{__package__ = }')

$ cat b.py
import runpy
runpy.run_path('a.py')

$ python3 b.py
__name__ = '<run_path>'
__package__ = ''
```

`__package__` is not set to None as in the doc.
History
Date User Action Args
2022-03-05 00:01:39yanhao.charlessetrecipients: + yanhao.charles
2022-03-05 00:01:39yanhao.charlessetmessageid: <1646438499.21.0.962171023528.issue46926@roundup.psfhosted.org>
2022-03-05 00:01:39yanhao.charleslinkissue46926 messages
2022-03-05 00:01:39yanhao.charlescreate