This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: f_trace gets call on different lines each loop
Type: behavior Stage:
Components: Interpreter Core Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: MegaIng
Priority: normal Keywords:

Created on 2020-11-07 22:19 by MegaIng, last changed 2022-04-11 14:59 by admin.

Files
File name Uploaded Description Edit
f_trace_wrong_line.py MegaIng, 2020-11-07 22:19
Messages (1)
msg380527 - (view) Author: (MegaIng) Date: 2020-11-07 22:19
When using a local trace function, sometimes the line event is issued at the wrong time. As can be seen from the example file `f_trace_wrong_line.py`, each loop iteration we get either 24 or 23, apparently in a fixed rhythm.

While this might seem harmless, it appears that the line event for 23 (In this example) is issued at a time where the state of the stack is not valid to switch line. I noticed this because I wanted to implement a context manager that skips to a specific line, but this broken with mysterious error message `TypeError: 'NoneType' object is not callable` which I think is caused by the `with`-line not being fully executed and the stack still having the return value of `__enter__` on it.



Here the intro line of the interpreter:

Python 3.9.0 (tags/v3.9.0:9cf6752, Oct  5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32
History
Date User Action Args
2022-04-11 14:59:37adminsetgithub: 86452
2020-11-07 22:19:52MegaIngcreate