This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xdegaye
Recipients georg.brandl, xdegaye
Date 2014-02-25.11:02:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
After the pdb 'continue' command, the signal module owns a reference to Pdb.sigint_handler. On the next instantiation of pdb, the signal module owns a reference to a new sigint_handler method that owns a reference to the previous sigint_handler. As a consequence, the first pdb instance is never freed (as well as the frames that are referenced by this pdb instance). The following test demonstrates the problem that is fixed by the attached patch.

Run the following script:

# START of
import sys, gc, pdb

i = 1
while i:
    x = 1
    gc.collect(); print(sys.gettotalrefcount())

# END of

With the following pdb commands:

$ python
> /tmp/test/<module>()
-> x = 1
(Pdb) continue
> /home/xavier/tmp/test/<module>()
-> pdb.set_trace()
(Pdb) continue
> /tmp/test/<module>()
-> x = 1
(Pdb) continue
> /tmp/test/<module>()
-> pdb.set_trace()
(Pdb) i = 0
(Pdb) continue
Date User Action Args
2014-02-25 11:02:34xdegayesetrecipients: + xdegaye, georg.brandl
2014-02-25 11:02:34xdegayesetmessageid: <>
2014-02-25 11:02:34xdegayelinkissue20766 messages
2014-02-25 11:02:34xdegayecreate