Bug in Python
John O'Hagan
research at johnohagan.com
Wed Apr 18 01:33:04 EDT 2012
On Wed, 18 Apr 2012 03:08:08 +0200
Kiuhnm <kiuhnm03.4t.yahoo.it at mail.python.org> wrote:
> I'm using Python 3.2.2, 64 bit on Windows 7.
>
> Consider this code:
> --->
> print(1)
> print(2)
> print(3)
>
> with open('test') as f:
> data = f.read()
> with open('test') as f:
> data = f.read()
> <---
> If I debug this code with
> python -m pdb script.py
> and I issue the command
> j 7
> Python crashes.
I get this with 2.7.2 and 3.2.3 on Debian.
I did some experiments:
The "script" file can contain as little as
with 1 as f:
pass
pass
and the segfault will occur if 'j 3' is issued. It seems jumping anywhere within
the file beyond the context manager will trigger it.
With 2.7 the segfault happens consistently. With 3.2, it's complicated: it
occurs every nth time 'j 3' is issued where n < 5 or thereabouts. However, if it
doesn't happen when the command is issued, it happens when 'exit' is called.
Hopefully some of this is a clue.
Regards,
John
More information about the Python-list
mailing list