Title: __package__ not set to None under pdb in Python 3
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.4, Python 3.5
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Keith Prussing, eric.snow, ncoghlan
Priority: normal Keywords:

Created on 2015-11-20 16:02 by Keith Prussing, last changed 2020-09-11 23:12 by brett.cannon.

File name Uploaded Description Edit Keith Prussing, 2015-11-20 16:02 Minimum working example
Messages (1)
msg254989 - (view) Author: Keith Prussing (Keith Prussing) Date: 2015-11-20 16:02
When a module is run under pdb in Python 3, __package__ is set to the empty string instead of None.  The attached minimum working example depicts this behavior.  The results are summarized in the following table.

=============== ====== ======
    Command      Py 2   Py 3
=============== ====== ======
 python          None   None
 python -m        ''     ''
 python -m pdb   None    ''
 pdb             None    ''
=============== ====== ======

The behavior I expected was for the Python executable to treat the input file as a script and not a module.  My rationale is that pdb is loaded as the executing module that accepts a script as its argument.  Per the help, only one -m option is allowed when launching python.
Date User Action Args
2020-09-11 23:12:04brett.cannonsetnosy: - brett.cannon
components: + Library (Lib), - Extension Modules
2016-01-14 23:01:15SilentGhostsetnosy: + brett.cannon, ncoghlan, eric.snow
2015-11-20 16:02:19Keith Prussingcreate