mdmintz / pdbp

pdbp (Pdb+): A drop-in replacement for pdb and pdbpp. To replace "pdb", add "import pdbp" to an "__init__.py" file.
Other
75 stars 2 forks source link

PYTHONBREAKPOINT=pdbp.set_trace has no effect #56

Closed jamilraichouni closed 1 year ago

jamilraichouni commented 1 year ago

Hi!

So far I used pdb++ which is not maintained anymore and I'm quite happy that I found your project here. Many thanks!

I have a question wrt. to version 1.5.0

I'm wondering why the PYTHONBREAKPOINT env var has no effect. When I set it like documented and run

PYTHONBREAKPOINT=pdbp.set_trace python -m pdb -m my_library_module

the standard PDB w/o syntax highlighting comes up. When I run it like

PYTHONBREAKPOINT=pdbp.set_trace python -m pdbp -m my_library_module

PDB+ launches.

Is there anything I miss. My hope was that setting the env var results into sth. which is similar to the dropin-replacement behaviour of pdb++.

All best, Jamil

mdmintz commented 1 year ago

Hello!

For the standard pdb replacement, placing import pdbp into an __init__.py takes care of that, and any breakpoints you encounter in Python programs will use the newer Pdb+.

But unlike the old pdbpp (pdb++), we're not overwriting the System pdb, as that could lead to a lot of other problems, and may even pose a security risk. Instead, we've left the original pdb as is, and that can still be activated via python -m pdb MODULE as needed. For pdbp (Pdb+), that can be activated via python -m pdbp MODULE, as you saw. This gives people the most flexibility, and also makes it easy to compare the differences between pdb, and the improved pdbp (Pdb+).

All the best, Michael

jamilraichouni commented 1 year ago

Ah, I see. The env var just influences how a breakpoint() set somewhere in the code is being picked up. Thank you!