From 79920af3064a78fe410efc26f9be141949dbf4d3 2012-08-27 06:06:44 From: jstenar Date: 2012-08-27 06:06:44 Subject: [PATCH] replacing pop call that could be made on ampty list --- diff --git a/IPython/core/debugger.py b/IPython/core/debugger.py index 1339ec1..c7c17eb 100644 --- a/IPython/core/debugger.py +++ b/IPython/core/debugger.py @@ -353,7 +353,15 @@ class Pdb(OldPdb): start = lineno - 1 - context//2 lines = linecache.getlines(filename) try: - encoding, _ = openpy.detect_encoding(lambda :lines[:2].pop(0)) + def readline(x): + x = x[:2] + def _readline(): + if x: + return x.pop(0) + else: + raise StopIteration + return _readline + encoding, _ = openpy.detect_encoding(readline(lines)) except SyntaxError: encoding = "ascii" start = max(start, 0)