Message414555
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. |
|
Date |
User |
Action |
Args |
2022-03-05 00:01:39 | yanhao.charles | set | recipients:
+ yanhao.charles |
2022-03-05 00:01:39 | yanhao.charles | set | messageid: <1646438499.21.0.962171023528.issue46926@roundup.psfhosted.org> |
2022-03-05 00:01:39 | yanhao.charles | link | issue46926 messages |
2022-03-05 00:01:39 | yanhao.charles | create | |
|