[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: python: Let pdb tracking not kill buffers

From: Lawrence Liu
Subject: Re: python: Let pdb tracking not kill buffers
Date: Mon, 7 Oct 2019 12:33:17 +0800


I am a full time python developer and seems in my case mostly I am using the way as below:

insert a 

import pdb; pdb.set_trace();

in my code bass and trigger the break point from other place (mostly browser) and wait for the break point been hit. 


Eli Zaretskii <address@hidden>于2019年10月5日 周六14:41写道:
> From: Andrii Kolomoiets <address@hidden>
> Date: Fri, 4 Oct 2019 23:32:09 +0300
> 1. echo "import pdb; pdb.set_trace()" > test.py
> 2. emacs -Q
> 3. M-x run-python
> 4. M-x python-shell-send-file <RET> test.py <RET>
> Now there are two windows: one with pdb session and another one with
> source code.
> Now in pdb prompt: pass<RET>
> The source code buffer is killed because pdb tracking comint output
> filter doesn't found file name in the output and decides that tracking
> session is over.
> This behavior interferes with debug session. Moving frame up/down the
> stack trace open new files but evaluating some code kill them when they
> are still needed.


Aren't users supposed to use pdb via "M-x pdb" instead?  (I don't use
this, and don't debug Python programs, so maybe my question makes no

> Attached patch brings the following changes:
> - New variable `python-pdbtrack-kill-buffers' that make buffers killing
>   optional;
> - Comint input filter which decides that the debug session is over;
> - Process sentinel to finish tracking when python process is killed.
> Please see attached patch. I certainly sure docstrings and naming are
> not so good but they can be fine tuned later if the main idea will be
> accepted.

Besides the question I asked above, your patch is too large to be
accepted without assigning copyright to the FSF.  Would you like to
start the legal paperwork rolling, so that any contributions from you
could be accepted without limitations?

> +(defcustom python-pdbtrack-continue-command '("c" "cont" "continue")
> +  "Pdb continue command."
> +  :type 'list
> +  :group 'python)

Each new defcustom should have a :version tag.  Also, if they belong
to the group of the current file, our convention is not to use :group,
as that's redundant.

In addition, please try making the doc strings explain how is the
variable used and what is its effect, including (if applicable) the
effect of special values, like nil etc.

> +(defcustom python-pdbtrack-kill-buffers t
> +  "Kill buffers when tracking is finished.
> +Only buffers opened during tracking will be killed."

The first sentence should be "If non-nil, kill buffers when tracking
is finished."  (And that is somewhat unclear, because it isn't clear
what it means "when tracking is finished".)

Best Regards

reply via email to

[Prev in Thread] Current Thread [Next in Thread]