@@ -104,7 +104,7 @@ def runsource(self, source, filename=None, symbol='single',
104
104
code.InteractiveInterpreter.runsource. If encode is True, the source
105
105
will be encoded. On Python 3.X, encode will be ignored."""
106
106
if not py3 and encode :
107
- source = u'# coding: %s\n %s' % (self .encoding , source )
107
+ source = u'# coding: %s\n \n %s' % (self .encoding , source )
108
108
source = source .encode (self .encoding )
109
109
if filename is None :
110
110
filename = filename_for_console_input (source )
@@ -132,7 +132,7 @@ def showsyntaxerror(self, filename=None):
132
132
else :
133
133
# Stuff in the right filename and right lineno
134
134
if not py3 :
135
- lineno -= 1
135
+ lineno -= 2
136
136
value = SyntaxError (msg , (filename , lineno , offset , line ))
137
137
sys .last_value = value
138
138
list = traceback .format_exception_only (type , value )
@@ -153,7 +153,7 @@ def showtraceback(self):
153
153
if not py3 :
154
154
for i , (fname , lineno , module , something ) in enumerate (tblist ):
155
155
if fname == '<input>' :
156
- tblist [i ] = (fname , lineno - 1 , module , something )
156
+ tblist [i ] = (fname , lineno - 2 , module , something )
157
157
158
158
l = traceback .format_list (tblist )
159
159
if l :
0 commit comments