[issue46926] runpy.run_path didn't set __package__ to None as describe in doc

2022-03-08 Thread Charlie Yan


Change by Charlie Yan :


--
components: +Library (Lib)
type:  -> behavior

___
Python tracker 
<https://bugs.python.org/issue46926>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46926] runpy.run_path didn't set __package__ to None as describe in doc

2022-03-04 Thread Charlie Yan


Change by Charlie Yan :


--
title: runpy.run_path didn't set __package__ as describe in doc -> 
runpy.run_path didn't set __package__ to None as describe in doc

___
Python tracker 
<https://bugs.python.org/issue46926>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46926] runpy.run_path didn't set __package__ as describe in doc

2022-03-04 Thread Charlie Yan


New submission from Charlie Yan :

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__ = ''
__package__ = ''
```

`__package__` is not set to None as in the doc.

--
messages: 414555
nosy: yanhao.charles
priority: normal
severity: normal
status: open
title: runpy.run_path didn't set __package__ as describe in doc
versions: Python 3.8

___
Python tracker 
<https://bugs.python.org/issue46926>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com