Package: python2.5
Version: 2.5.4-1
Severity: normal
Tags: patch

As a result of i/o buffering, pdb is unable to debug some programs:

$ cat foo
#!/usr/bin/python

import os

for i in range(1001):
    pass

os._exit(1)
$ yes s | pdb foo | tail | grep .
(Pdb) > /tmp/foo(5)<module>()
-> for i in range(1001):
(Pdb) > /tmp/foo(6)<module>()
-> pass
(Pdb) > /tmp/foo(5)<module>()
-> for i in range(1001):
(Pdb) > /tmp/foo(6)<module>()
-> pass
(Pdb) > /tmp/foo(5)<module>()
-> for i in range(100
$

(See #529429 for a real world example. PYTHONUNBUFFERED can be used as a
workaroud. Output is not necessarily deterministic.)

Please flush the output buffer on prompt. The attached patch fixes the problem.

Attachment: pdb-flush.patch
Description: application/octetstream

Reply via email to