[issue13548] Invalid 'line' tracer event on pass within else clause

2016-06-02 Thread Jelle Zijlstra

Jelle Zijlstra added the comment:

The reason for this behavior is that the trace function is called whenever 
execution in the bytecode jumps to a new source line. See ceval.c line 4440 or 
so:

/* If the last instruction falls at the start of a line or if
   it represents a jump backwards, update the frame's line
   number and call the trace function. */

Running dis.dis on x in the example file shows that the bytecode for returning 
None is assigned to the "pass" line.

I think the bug here is really with the line number assignment in the bytecode, 
not with the tracing, but I don't see an obvious way to fix it.

--
nosy: +Jelle Zijlstra

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13548] Invalid 'line' tracer event on pass within else clause

2011-12-12 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

(Snippet examples can be made 2/3 agnostic with 
from __future__ import print_function)

3.2.2 on win7, IDLE, gives me
F:\Python\mypy\tem.py 7 call
F:\Python\mypy\tem.py 8 line
F:\Python\mypy\tem.py 10 line
F:\Python\mypy\tem.py 11 line
F:\Python\mypy\tem.py 13 line
F:\Python\mypy\tem.py 13 return
...
Commenting out else:pass or changing pass to r=2 changes the output to
F:\Python\mypy\tem.py 7 call
F:\Python\mypy\tem.py 8 line
F:\Python\mypy\tem.py 10 line
F:\Python\mypy\tem.py 11 line
F:\Python\mypy\tem.py 11 return

Looking as the dis outputs of the three versions, I find the difference of 
behavior somewhat puzzling.

--
nosy: +terry.reedy
versions: +Python 3.3 -Python 2.6, Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13548
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13548] Invalid 'line' tracer event on pass within else clause

2011-12-07 Thread Stephan R.A. Deibel

New submission from Stephan R.A. Deibel sdei...@wingware.com:

The tracer set with sys.settrace() is called incorrectly with a 'line' event on 
a 'pass' that is at the end of an 'else' clause on the final line of a function 
even if the else block is not executed by the interpreter.  Whew, talk about an 
end case!  The attached file illustrates this.

--
components: Interpreter Core
files: badlineevent.py
messages: 148974
nosy: sdeibel
priority: normal
severity: normal
status: open
title: Invalid 'line' tracer event on pass within else clause
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file23865/badlineevent.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13548
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13548] Invalid 'line' tracer event on pass within else clause

2011-12-07 Thread Ned Batchelder

Changes by Ned Batchelder n...@nedbatchelder.com:


--
nosy: +nedbat

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13548
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13548] Invalid 'line' tracer event on pass within else clause

2011-12-07 Thread Stephan R.A. Deibel

Stephan R.A. Deibel sdei...@wingware.com added the comment:

Sorry, the print statement in the file needs a tweak to work with Python 3.2, 
but the bug does occur there also.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13548
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com