[issue42384] Inconsistent sys.path between python and pdb

2021-01-21 Thread Andrey Bienkowski


Andrey Bienkowski  added the comment:

I'll give it a try

--

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



[issue42384] Inconsistent sys.path between python and pdb

2021-01-24 Thread Andrey Bienkowski


Change by Andrey Bienkowski :


--
pull_requests: +23139
pull_request: https://github.com/python/cpython/pull/24320

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



[issue42384] Inconsistent sys.path between python and pdb

2021-01-25 Thread Andrey Bienkowski


Change by Andrey Bienkowski :


--
pull_requests: +23140
pull_request: https://github.com/python/cpython/pull/24321

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



[issue42384] Inconsistent sys.path between python and pdb

2021-01-25 Thread Andrey Bienkowski


Change by Andrey Bienkowski :


--
pull_requests: +23141
pull_request: https://github.com/python/cpython/pull/23412

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



[issue42383] Pdb does not correclty restart the target if it changes the current directory

2021-01-25 Thread Andrey Bienkowski


Change by Andrey Bienkowski :


--
pull_requests: +23142
pull_request: https://github.com/python/cpython/pull/24322

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



[issue42383] Pdb does not correclty restart the target if it changes the current directory

2021-01-25 Thread Andrey Bienkowski


Change by Andrey Bienkowski :


--
pull_requests: +23143
pull_request: https://github.com/python/cpython/pull/24323

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



[issue42383] Pdb does not correclty restart the target if it changes the current directory

2020-11-16 Thread Andrey Bienkowski


New submission from Andrey Bienkowski :

This was mentioned in #31121, but I believe this deserves its own separate 
issue. If the debug target is specified using a relative path and later the 
current directory is changed, pdb tries to search for the target in the new 
current directory. This currently causes pdb to be unable to exit, which is 
what #31121 and #14743 are about, but even if they are fixed we would still be 
left with pdb exiting instead of restarting the target. This issues is about 
the latter.

To reproduce (same as #31121):

$ mkdir foo
$ cat > foo/script.py
import os
os.chdir('foo')
$ python3 -m pdb foo/script.py 
> /home/user/foo/script.py(1)()
-> import os
(Pdb) c
The program finished and will be restarted
Traceback (most recent call last):
  File "/usr/lib64/python3.8/pdb.py", line 1704, in main
pdb._runscript(mainpyfile)
  File "/usr/lib64/python3.8/pdb.py", line 1570, in _runscript
with io.open_code(filename) as fp:
FileNotFoundError: [Errno 2] No such file or directory: 'foo/script.py'
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /usr/lib64/python3.8/pdb.py(1570)_runscript()
-> with io.open_code(filename) as fp:

--
messages: 381213
nosy: hexagonrecursion
priority: normal
severity: normal
status: open
title: Pdb does not correclty restart the target if it changes the current 
directory

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



[issue31121] Unable to exit pdb when script becomes invalid

2020-11-16 Thread Andrey Bienkowski


Andrey Bienkowski  added the comment:

Another way to reproduce this that will continue to work once #42383 is fixed 
is to delete or move the script while it's being debugged.

--
nosy: +hexagonrecursion

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



[issue42384] Inconsistent sys.path between python and pdb

2020-11-16 Thread Andrey Bienkowski


New submission from Andrey Bienkowski :

The first entry in sys.path is different between `python foo.py` and `python -m 
pdb foo.py`. In the former it is the absolute path to the parent directory of 
foo.py while in the later it is a relative path (unless the debug target was 
specified using an absolute path). The meaning of the absolute path does not 
change when the current directory changes (e.g. via os.chdir()) while the 
meaning of the relative path does. Like any environment inconsistency between 
regular program execution and the debugger this may lead to bugs that 
mysteriously vanish when you try to debug them.

$ cat > print-path.py
import sys
from pprint import pprint

pprint(sys.path)
$ python3 print-path.py 
['/home/user',
 '/usr/lib64/python38.zip',
 '/usr/lib64/python3.8',
 '/usr/lib64/python3.8/lib-dynload',
 '/usr/lib64/python3.8/site-packages',
 '/usr/lib/python3.8/site-packages']
$ python3 -m pdb print-path.py  
> /home/user/print-path.py(1)()
-> import sys
(Pdb) c
['',
 '/usr/lib64/python38.zip',
 '/usr/lib64/python3.8',
 '/usr/lib64/python3.8/lib-dynload',
 '/usr/lib64/python3.8/site-packages',
 '/usr/lib/python3.8/site-packages']

--
messages: 381215
nosy: hexagonrecursion
priority: normal
severity: normal
status: open
title: Inconsistent sys.path between python and pdb

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



[issue42384] Inconsistent sys.path between python and pdb

2020-11-16 Thread Andrey Bienkowski


Andrey Bienkowski  added the comment:

I'll look into fixing this after I fix #42383

--

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



[issue42383] Pdb does not correclty restart the target if it changes the current directory

2020-11-16 Thread Andrey Bienkowski


Andrey Bienkowski  added the comment:

I'm working on fixing this

--

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



[issue42384] Inconsistent sys.path between python and pdb

2020-11-17 Thread Andrey Bienkowski


Andrey Bienkowski  added the comment:

After reading Lib/pdb.py:main I believe I can fix both by changing a single 
line.

--

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



[issue42383] Pdb does not correclty restart the target if it changes the current directory

2020-11-17 Thread Andrey Bienkowski


Change by Andrey Bienkowski :


--
keywords: +patch
pull_requests: +7
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/23338

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



[issue42384] Inconsistent sys.path between python and pdb

2020-11-17 Thread Andrey Bienkowski


Change by Andrey Bienkowski :


--
keywords: +patch
pull_requests: +8
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/23338

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



[issue42387] Pdb should restore the execution environment before reexecuting the target

2020-11-17 Thread Andrey Bienkowski


New submission from Andrey Bienkowski :

When the target exits, pdb automatically restarts it. If the target changed 
something before exiting the changes will remain unless pdb explicitly undoes 
them. While working on #42383 I had an idea: it would be useful if pdb reverted 
the changes the target makes to the execution environment (to a reasonable 
extent) before restarting it. This includes:

1. os.getcwd() - currently not reverted
2. os.environ - I did not check if this is currently restored or not
3. sys.argv - --/--
4. sys.path - --/--

--
components: Library (Lib)
messages: 381225
nosy: hexagonrecursion
priority: normal
severity: normal
status: open
title: Pdb should restore the execution environment before reexecuting the 
target

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



[issue42383] Pdb does not correclty restart the target if it changes the current directory

2020-11-19 Thread Andrey Bienkowski


Change by Andrey Bienkowski :


--
pull_requests: +22305
pull_request: https://github.com/python/cpython/pull/23412

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