python / psf-infra-meta

Meta-repository for PSF backed or managed systems. Created mainly for the issue tracker :)
10 stars 9 forks source link

Context manager does not update frame line number on exit #136

Closed asaboor-gh closed 2 years ago

asaboor-gh commented 2 years ago

When you use a context manager, you can collect code block inside it based on line number in sys._getframe().f_back.f_lineno and linecache.getlines(file). For example

with some_context():
    # At this point line number is N
    do_something()
    # exit line number is M

Before 3.10, M = N +2 holds but in 3.10 it is M = N. Is it a bug or new design?

matrixise commented 2 years ago

Please, this repo is not related to Python itself. If you think it's a bug, open an issue on https://bugs.python.org