[issue47163] "unterminated subpattern" in valid regex if re.VERBOSE is used

2022-03-30 Thread Ned Batchelder
Ned Batchelder added the comment: I realized my mistake... never mind! -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue47163] "unterminated subpattern" in valid regex if re.VERBOSE is used

2022-03-30 Thread Ned Batchelder
New submission from Ned Batchelder : In this code, the same regex is compiled with and without re.VERBOSE. Without, it compiles fine. With, it fails with an "unterminated subpattern" error. list_num_rx1 = r"""(?P\()?(\d+|#|[a-z])(?(paren)\)|\.)"&qu

[issue47085] missing frame.f_lineno on JUMP_ABSOLUTE

2022-03-21 Thread Ned Batchelder
Change by Ned Batchelder : -- nosy: +Mark.Shannon, nedbat ___ Python tracker <https://bugs.python.org/issue47085> ___ ___ Python-bugs-list mailing list Unsub

[issue47046] Add `f_state` attribute to FrameObjects.

2022-03-17 Thread Ned Batchelder
Ned Batchelder added the comment: These look great. Currently, coverage.py only tries to distinguish between return/yield, which I guess will now be COMPLETED and SUSPENDED? -- ___ Python tracker <https://bugs.python.org/issue47

[issue46911] Early tracing has lineno=None for modules

2022-03-05 Thread Ned Batchelder
Ned Batchelder added the comment: Maybe I'm missing something during normal execution, but I'm only seeing this effect now during this super-early encodings.py trick. I don't mind just special-casing the Nones in this case. -- ___

[issue46389] 3.11: unused generator comprehensions cause f_lineno==None

2022-03-03 Thread Ned Batchelder
Ned Batchelder added the comment: Yes, this is fixed, thanks. -- ___ Python tracker <https://bugs.python.org/issue46389> ___ ___ Python-bugs-list mailin

[issue46911] Early tracing has lineno=None for modules

2022-03-03 Thread Ned Batchelder
New submission from Ned Batchelder : Coverage.py has a trick to measure the early execution of stdlib modules. It has an "encodings.py" file that sets a trace function, then gets out of the way to let the real encodings.py execute. In 3.11.0a5, that early trace function gets None

[issue46282] return value of builtins is not clearly indicated

2022-02-08 Thread Ned Batchelder
Ned Batchelder added the comment: What we're debating here is a micro-cosm of the broader "documentation philosophy" questions that I'm hoping the Documentation WG can iron out. What is "obvious"? Is it obvious that print returns None when file.write does n

[issue46282] return value of builtins is not clearly indicated

2022-02-07 Thread Ned Batchelder
Ned Batchelder added the comment: > When you state the obvious... Obvious to who? New learners coming to Python don't know the same things as people with experience. -- nosy: +nedbat ___ Python tracker <https://bugs.python.org

[issue42197] Disable automatic update of frame locals during tracing

2022-01-21 Thread Ned Batchelder
Ned Batchelder added the comment: And btw, the tests with that branch ran at least twice as fast as with 3.10! -- ___ Python tracker <https://bugs.python.org/issue42

[issue42197] Disable automatic update of frame locals during tracing

2022-01-21 Thread Ned Batchelder
Ned Batchelder added the comment: I ran the coverage.py test suite using https://github.com/faster-cpython/cpython/tree/dont-fast-to-locals-in-trampoline, and there were no failures. -- ___ Python tracker <https://bugs.python.org/issue42

[issue42197] Disable automatic update of frame locals during tracing

2022-01-21 Thread Ned Batchelder
Ned Batchelder added the comment: Off the top of my head, I'm not sure this affects coverage.py at all, but I could be missing something. Does PR 23028 have all the changes, or is there some other python/cpython branch I can test

[issue46402] Enhance sqlite3 to avoid implicit creation?

2022-01-18 Thread Ned Batchelder
Ned Batchelder added the comment: BTW, I'm fine with this being closed, since the functionality I wanted is available and documented. -- ___ Python tracker <https://bugs.python.org/is

[issue46402] Enhance sqlite3 to avoid implicit creation?

2022-01-17 Thread Ned Batchelder
Ned Batchelder added the comment: @Erlend: thanks for the URI tip, I missed that as a possibility in the SQLite docs. -- ___ Python tracker <https://bugs.python.org/issue46

[issue46402] Enhance sqlite3 to avoid implicit creation?

2022-01-16 Thread Ned Batchelder
New submission from Ned Batchelder : The sqlite3 library implicitly creates the database if the requested file doesn't exist. I would like to be able to avoid that implicit creation. (Actually, it would be enough to know whether I had created the database, but the underlying SQLite li

[issue46389] 3.11: unused generator comprehensions cause f_lineno==None

2022-01-15 Thread Ned Batchelder
New submission from Ned Batchelder : In Python 3.11, unused generator comprehensions cause trace events with f_lineno set to None. %< - import linecache, sys def trace(frame, event, arg): # The weird globals here is to avoi

[issue46314] Stray RESUME opcode for unused lambda

2022-01-12 Thread Ned Batchelder
Ned Batchelder added the comment: This fixes the problems I was seeing, thanks. -- ___ Python tracker <https://bugs.python.org/issue46314> ___ ___ Python-bug

[issue46331] 3.11: tracing revisits class line after class docstring

2022-01-12 Thread Ned Batchelder
Ned Batchelder added the comment: Yes, thanks, this fixes it. -- ___ Python tracker <https://bugs.python.org/issue46331> ___ ___ Python-bugs-list mailin

[issue46344] 3.11: except/else/if/raise traced incorrectly

2022-01-11 Thread Ned Batchelder
New submission from Ned Batchelder : This code shows a raise inside an except/else/if that isn't run, but incorrectly appears in the trace output (see the * line): $ cat arcs_1160.py def func(x): try: b = 6 except ZeroDivisionError: pass else:

[issue46331] 3.11: tracing revisits class line after class docstring

2022-01-10 Thread Ned Batchelder
New submission from Ned Batchelder : See the starred line in the trace output for 3.11: $ cat class_def.py class theClass: ''' the docstring. ''' def __init__(self): ''' Another docstring. ''' self.a = 1 $

[issue46225] f_lasti behaves differently for lambdas returned from loops

2022-01-09 Thread Ned Batchelder
Ned Batchelder added the comment: Thanks, it does help. While updating coverage.py to use the RESUME information, I found another problem: https://bugs.python.org/issue46314 -- ___ Python tracker <https://bugs.python.org/issue46

[issue46314] Stray RESUME opcode for unused lambda

2022-01-09 Thread Ned Batchelder
New submission from Ned Batchelder : This code seems to get a RESUME opcode where no function call is happening: a = 1 fn = lambda 2 b = 3 Here is the disassembly. Offset 6 has a RESUME opcode for line 2: Python 3.11.0a3+ (heads/main:0fc58c1e05, Jan 8 2022, 19:45:58) [Clang

[issue46234] 3.11: Tracing of decorators now visits the decorator line before the decorator function

2022-01-02 Thread Ned Batchelder
New submission from Ned Batchelder : Sometime after 3.11.0a3, tracing of decorators changed so that each decorator line is revisited as the decorator is invoked. Is this intentional? ---< dectrace.py >--- import linecache, sys def trace(frame, even

[issue46225] f_lasti behaves differently for lambdas returned from loops

2022-01-02 Thread Ned Batchelder
Ned Batchelder added the comment: Also, this only happens with a Python trace function. With a C trace function, pPyFrameObject->f_frame->f_lasti is -1. -- ___ Python tracker <https://bugs.python.org/i

[issue46225] f_lasti behaves differently for lambdas returned from loops

2022-01-02 Thread Ned Batchelder
New submission from Ned Batchelder : Python 3.11.0a3 changed how f_lasti behaves when calling a function in some situations. This example shows returning a lambda from a function. If the lambda is returned in a loop, then frame.f_lasti is 0 when it is called. If the lambda is not in a loop

[issue46028] 3.11.0a3: under tox, sys._base_executable is wrong

2021-12-16 Thread Ned Batchelder
Ned Batchelder added the comment: Thanks, your change looks good. The exact symlinks in the nested venv's are different for 3.10.1 and your 3.11, but they both work: $ python3.10 -c "import sys; print(sys.version)" 3.10.1 (main, Dec 14 2021, 08:30:13) [Clang 12.0.0 (cla

[issue46028] 3.11.0a3: under tox, sys._base_executable is wrong

2021-12-16 Thread Ned Batchelder
Ned Batchelder added the comment: Here's the experiment again with 3.10.1 and 3.11.0a3, and more ls's: $ python3.10 -V Python 3.10.1 $ python3.10 -m venv v310 $ ls -al v310/bin total 72 drwxr-xr-x 12 nedbatchelder wheel 384 Dec 16 06:42 ./ drwxr-xr-x 6 nedbatchelder wheel

[issue46028] 3.11.0a3: under tox, sys._base_executable is wrong

2021-12-14 Thread Ned Batchelder
Ned Batchelder added the comment: > I assume /private/tmp/bpo-46028/311-nested/bin/python3.11 exists though? Yes, that file exists, but it's a symlink to a non-existent file: $ ls -al 311-nested/bin total 0 drwxr-xr-x 5 nedbatchelder wheel 160 Dec 13 18:04 ./ drwxr-xr-x 6 nedba

[issue46028] 3.11.0a3: under tox, sys._base_executable is wrong

2021-12-13 Thread Ned Batchelder
Ned Batchelder added the comment: Demonstration of a problem with only stdlib, and no undocumented features. This is on a Mac: This works: $ python3.10 -V Python 3.10.0 $ python3.10 -m venv v310 $ v310/bin/python -m venv v310-nested $ v310-nested/bin/python -V Python 3.10.0 This does

[issue46028] 3.11.0a3: under tox, sys._base_executable is wrong

2021-12-13 Thread Ned Batchelder
Ned Batchelder added the comment: This started because a set of tests in the coverage.py test suite fail with 3.11.0a3. They attempt to create a venv in the test, and the test is already running inside a virtualenv. The venv creation fails, with a reference to a non-existent file. I

[issue46028] 3.11.0a3: under tox, sys._base_executable is wrong

2021-12-11 Thread Ned Batchelder
Ned Batchelder added the comment: The two venvs seem analogous: $ cat venv_a2/pyvenv.cfg home = /usr/local/bin include-system-site-packages = false version = 3.11.0 $ ls -al venv_a2/bin total 72 drwxr-xr-x 13 nedbatchelder wheel 416 Dec 11 10:43 ./ drwxr-xr-x 6 nedbatchelder wheel

[issue46028] 3.11.0a3: under tox, sys._base_executable is wrong

2021-12-11 Thread Ned Batchelder
Ned Batchelder added the comment: Tox isn't needed, just venv from the stdlib: $ python3.11.0a2 -m venv venv_a2 $ venv_a2/bin/python -c "import sys,os.path; print(e := sys._base_executable); print(os.path.exists(e))" /private/tmp/venv_a2/bin/python True $ python3.11.0a3

[issue46028] 3.11.0a3: under tox, sys._base_executable is wrong

2021-12-10 Thread Ned Batchelder
Ned Batchelder added the comment: git bisect also identifies that commit as the first bad: 99fcf1505218464c489d419d4500f126b6d6dc28 is the first bad commit commit 99fcf1505218464c489d419d4500f126b6d6dc28 Author: Steve Dower Date: Fri Dec 3 00:08:42 2021 + bpo-45582: Port getpath

[issue46028] 3.11.0a3: under tox, sys._base_executable is wrong

2021-12-09 Thread Ned Batchelder
New submission from Ned Batchelder : Under tox, sys._base_executable is not an actual file for 3.11.0a3. It was fine in 3.11.0a2. To reproduce: --- 8< # tox.ini [tox] envlist = py{310,311a2,311} skipsdist = True [testenv] commands = python -c "import sys

[issue45709] 3.11 regression: tracing with-statement on exit from block

2021-11-21 Thread Ned Batchelder
Ned Batchelder added the comment: I can confirm that this fixes the problem. -- ___ Python tracker <https://bugs.python.org/issue45709> ___ ___ Python-bug

[issue40421] [C API] Add getter functions for PyFrameObject and maybe move PyFrameObject to the internal C API

2021-11-10 Thread Ned Batchelder
Ned Batchelder added the comment: I went ahead and changed the coverage.py code to this: #if PY_VERSION_HEX >= 0x030B00A0 // 3.11 moved f_lasti into an internal structure. This is totally the wrong way // to make this work, but it's all I've got until https://bugs.python.org/iss

[issue45709] 3.11 regression: tracing with-statement on exit from block

2021-11-04 Thread Ned Batchelder
Ned Batchelder added the comment: BTW, this is the coverage.py issue: https://github.com/nedbat/coveragepy/issues/1270 -- ___ Python tracker <https://bugs.python.org/issue45

[issue45709] 3.11 regression: tracing with-statement on exit from block

2021-11-04 Thread Ned Batchelder
New submission from Ned Batchelder : Python 3.11 seems to have reverted a behavior that was new in 3.10.0b1: exiting a with-statement re-visits the with line on the way out. --- %< bug2.py -- import linecache, sys def trace(frame, event, arg): # The weird glob

[issue44450] Generator expressions trace differently on Windows than on Mac

2021-08-31 Thread Ned Batchelder
Ned Batchelder added the comment: Looks like this is fixed with 3.10.0rc1, thanks. -- ___ Python tracker <https://bugs.python.org/issue44450> ___ ___ Python-bug

[issue45020] Freeze all modules imported during startup.

2021-08-26 Thread Ned Batchelder
Change by Ned Batchelder : -- nosy: -nedbat ___ Python tracker <https://bugs.python.org/issue45020> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44840] Nested if/else gets phantom else trace again (3.10)

2021-08-09 Thread Ned Batchelder
Ned Batchelder added the comment: This fix looks good, thanks. -- ___ Python tracker <https://bugs.python.org/issue44840> ___ ___ Python-bugs-list mailin

[issue44840] Nested if/else gets phantom else trace again (3.10)

2021-08-05 Thread Ned Batchelder
New submission from Ned Batchelder : Note: this is very similar to https://bugs.python.org/issue42810 This was originally reported against coverage.py: https://github.com/nedbat/coveragepy/issues/1205 ---8<- import linecache, sys def trace(frame, event, arg): # The we

[issue44621] Python 3.9 traces async for/else incorrectly

2021-07-19 Thread Ned Batchelder
Ned Batchelder added the comment: @lukasz.langa, I guess this 3.9 tracing bug should also be closed as wont-fix? -- ___ Python tracker <https://bugs.python.org/issue44

[issue44672] Final "pass" is traced incorrectly in 3.9 (and before)

2021-07-19 Thread Ned Batchelder
Ned Batchelder added the comment: This is the right call. Thanks! -- ___ Python tracker <https://bugs.python.org/issue44672> ___ ___ Python-bugs-list mailin

[issue44672] Final "pass" is traced incorrectly in 3.9 (and before)

2021-07-19 Thread Ned Batchelder
New submission from Ned Batchelder : A simple function with a last "pass" statement gets traced incorrectly, attributing the return to the pass instead of the actual last statement executed: --- 8< -- import linecache, sys def trace(frame, event, ar

[issue44616] Incorrect tracing for "except" with variable

2021-07-15 Thread Ned Batchelder
Ned Batchelder added the comment: Barry, is it possible you accidentally used the beta 4? I ran the test suite with a freshly built 3.10, but by mistake was still using the beta, and was surprised. Once I really got the latest build in place (Python 3.10.0b4+ (heads/3.10:47695e3c88, Jul

[issue44626] Incorrect tracing of nested if/if/for/yield

2021-07-14 Thread Ned Batchelder
Ned Batchelder added the comment: The original reporter of the coverage.py issue says they have a simpler reproducer: https://github.com/nedbat/coveragepy/issues/1188#issuecomment-879572874 -- ___ Python tracker <https://bugs.python.

[issue44626] Incorrect tracing of nested if/if/for/yield

2021-07-13 Thread Ned Batchelder
New submission from Ned Batchelder : In Python 3.10, this code is traced incorrectly. I don't know if there's a simpler format that would show the problem. This code is already simplified from https://github.com/nedbat/coveragepy/issues/1188. -- import

[issue44622] async-for loops are traced incorrectly in Python 3.10

2021-07-13 Thread Ned Batchelder
New submission from Ned Batchelder : In Python 3.10, the traces at the end of an async-for loop are incorrect and different than at the end of a for-loop. -- import linecache, sys def trace(frame, event, arg): # The weird globals here is to avoid a NameError

[issue44621] Python 3.9 traces async for/else incorrectly

2021-07-13 Thread Ned Batchelder
Ned Batchelder added the comment: The corresponding coverage.py issue: https://github.com/nedbat/coveragepy/issues/1158 -- ___ Python tracker <https://bugs.python.org/issue44

[issue44621] Python 3.9 traces async for/else incorrectly

2021-07-13 Thread Ned Batchelder
New submission from Ned Batchelder : Python 3.9 traces this code incorrectly. Note: 3.8 and 3.10 are correct, only 3.9 gets it wrong. --- import linecache, sys def trace(frame, event, arg): # The weird globals here is to avoid a NameError on shutdown

[issue44616] Incorrect tracing for "except" with variable

2021-07-12 Thread Ned Batchelder
Ned Batchelder added the comment: Based on https://github.com/nedbat/coveragepy/issues/1187, btw -- ___ Python tracker <https://bugs.python.org/issue44

[issue44616] Incorrect tracing for "except" with variable

2021-07-12 Thread Ned Batchelder
New submission from Ned Batchelder : This construct isn't traced properly: except ExceptionName as var: if something: raise Here's a reproducer: -- 8< - import linecache, sys def trace(frame, event, arg): # The weird

[issue44600] match/case statements trace incorrectly in 3.10.0b4

2021-07-11 Thread Ned Batchelder
New submission from Ned Batchelder : Some simple match/case statements show incorrect tracing. Below is the code to run, as well as the output. Output lines with initial stars are incorrect: they incorrectly indicate that case bodies are executing when they are not. Sorry for the bulk here

[issue44570] 3.10.0b3 doesn't trace line events for return in some cases

2021-07-08 Thread Ned Batchelder
Ned Batchelder added the comment: I can confirm that those two pull requests fix the problem reported here. -- ___ Python tracker <https://bugs.python.org/issue44

[issue44570] 3.10.0b3 doesn't trace line events for return in some cases

2021-07-05 Thread Ned Batchelder
New submission from Ned Batchelder : (from https://github.com/nedbat/coveragepy/issues/1184) This code runs the return statement on line 17 twice. The second time, there is a "line" event and then a "return" event for that line. But the first time, there is only a &q

[issue44450] Generator expressions trace differently on Windows than on Mac

2021-06-21 Thread Ned Batchelder
Ned Batchelder added the comment: This was with 3.10.0b3. I haven't got a way (yet) to build with my own-built versions of CPython. -- ___ Python tracker <https://bugs.python.org/is

[issue44450] Generator expressions trace differently on Windows than on Mac

2021-06-21 Thread Ned Batchelder
Ned Batchelder added the comment: I tried adding that rewritten doit as a new test, and it does not show a mac/win difference on 3.9. In fact, it doesn't show a mac/win difference on 3.10! https://github.com/nedbat/coveragepy/actions/runs/9567

[issue44450] Generator expressions trace differently on Windows than on Mac

2021-06-19 Thread Ned Batchelder
Ned Batchelder added the comment: This happens with all the 3.10 betas, and does not happen in 3.9 and earlier: https://github.com/nedbat/coveragepy/runs/2864611225 (Sorry, other failures with earlier 3.10 betas obscured the mac/win difference

[issue44450] Generator expressions trace differently on Windows than on Mac

2021-06-18 Thread Ned Batchelder
New submission from Ned Batchelder : Here is a trace involving generator expressions. Using 3.10.0b3 on Mac, there are "line" events within the expression. Those events are missing on Windows. --- 8< --- import linecache, sys def trace(fram

[issue44446] linecache.getline TypeError when formatting tracebacks in stacks containing an async list comprehension

2021-06-17 Thread Ned Batchelder
Change by Ned Batchelder : -- nosy: +nedbat ___ Python tracker <https://bugs.python.org/issue6> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44298] 3.10.0b2 traces with-exit before the break that caused the exit

2021-06-03 Thread Ned Batchelder
Ned Batchelder added the comment: Thanks for the quick turnaround, this works! -- ___ Python tracker <https://bugs.python.org/issue44298> ___ ___ Python-bug

[issue44298] 3.10.0b2 traces with-exit before the break that caused the exit

2021-06-03 Thread Ned Batchelder
Ned Batchelder added the comment: (I'm not sure whether to create other issues for further details) I'm also seeing a return in a with will trace withexit/return for a plain "return" statement, but return/withexit/return for a return with a value ("return 17&

[issue44298] 3.10.0b2 traces with-exit before the break that caused the exit

2021-06-03 Thread Ned Batchelder
New submission from Ned Batchelder : Python 3.10 now traces back to with statements when exiting the with block. When the exit is a break statement, the with exit is visited before the break statement is. This seems confusing. --- 8< - imp

[issue43933] Regression in python3.10 with traceback frame having lineno of -1

2021-05-13 Thread Ned Batchelder
Ned Batchelder added the comment: Thanks, this fixes my issue. -- ___ Python tracker <https://bugs.python.org/issue43933> ___ ___ Python-bugs-list mailin

[issue43933] Regression in python3.10 with traceback frame having lineno of -1

2021-05-11 Thread Ned Batchelder
Ned Batchelder added the comment: BTW, I created a separate issue about this: https://bugs.python.org/issue44088 because I wasn't sure if I should continue on this one, sorry. Feel free to close either one. -- ___ Python tracker &

[issue44088] traced line number can be None

2021-05-09 Thread Ned Batchelder
New submission from Ned Batchelder : Mark, I'm not clear if the line number can still be None in some circumstances. With this code (from site.py in the stdlib): 545: def execsitecustomize(): 546: """Run custom site specific code, if available."""

[issue43933] Regression in python3.10 with traceback frame having lineno of -1

2021-05-04 Thread Ned Batchelder
Ned Batchelder added the comment: Mark, I'm not clear if the line number can still be None in some circumstances. With this code (from site.py in the stdlib): 545: def execsitecustomize(): 546: """Run custom site specific code, if available."""

[issue43933] Regression in python3.10 with traceback frame having lineno of -1

2021-05-04 Thread Ned Batchelder
Ned Batchelder added the comment: The pytest failure still happens with 3.10.0b1 and pytest 6.2.3. I'm asking if pytest can make a release to update. -- ___ Python tracker <https://bugs.python.org/is

[issue43933] Regression in python3.10 with traceback frame having lineno of -1

2021-05-04 Thread Ned Batchelder
Ned Batchelder added the comment: Thanks, tip of pytest works for me. Is this error going to happen for everyone testing with 3.10b1? If so, can we get a release of pytest? -- ___ Python tracker <https://bugs.python.org/issue43

[issue41129] setup.py test for macOS SDK files may incorrectly classify files in other file systems

2021-05-01 Thread Ned Batchelder
Change by Ned Batchelder : -- keywords: +patch pull_requests: +24475 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/25785 ___ Python tracker <https://bugs.python.org/issu

[issue43933] Regression in python3.10 with traceback frame having lineno of -1

2021-05-01 Thread Ned Batchelder
Ned Batchelder added the comment: I'm trying to see if these changes affect coverage.py, but pytest 6.2.3 fails with: === CPython 3.10.0a7+ (rev 558df90109) with Python tracer (.tox/anypy/bin/python) === ImportError while loading conftest '/Users/nedbatchelder/coverage/t

[issue41129] setup.py test for macOS SDK files may incorrectly classify files in other file systems

2021-05-01 Thread Ned Batchelder
Ned Batchelder added the comment: I just spent an hour debugging this problem. I don't understand the intricacies of how setup.py is looking for files, but more and more people will have Catalina and the issue this presents. I can confirm that Andrew's suggestion works. Can w

[issue43933] Regression in python3.10 with traceback frame having lineno of -1

2021-04-26 Thread Ned Batchelder
Ned Batchelder added the comment: Mark, you say: > The traceback for 3.9 is incorrect, the program is not on line 10 when > __exit__ is called. It's kind of not on any line in main(), but line 10 is the most useful line to indicate. It's the last bit of the user's

[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-04-13 Thread Ned Batchelder
Change by Ned Batchelder : -- nosy: +nedbat ___ Python tracker <https://bugs.python.org/issue43833> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42823] Incorrect frame.f_lineno when frame.f_trace is set

2021-04-04 Thread Ned Batchelder
Change by Ned Batchelder : -- stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue42823> ___ ___ Pyth

[issue42246] Implement PEP 626 -- Precise line numbers for debugging

2021-03-16 Thread Ned Batchelder
Ned Batchelder added the comment: Is there a reason PEP 626 isn't yet mentioned in https://docs.python.org/3.10/whatsnew/3.10.html ? -- ___ Python tracker <https://bugs.python.org/is

[issue42634] Incorrect line number in bytecode for try-except-finally

2021-02-01 Thread Ned Batchelder
Ned Batchelder added the comment: This problem no longer appears with master (commit 9eb11a139f). -- ___ Python tracker <https://bugs.python.org/issue42

[issue42823] Incorrect frame.f_lineno when frame.f_trace is set

2021-01-06 Thread Ned Batchelder
Ned Batchelder added the comment: OK, thanks. I guess the parallels between the Python frame object and the C frame object made it easy to think I could use the fields directly. I'm updating the coverage.py code. -- ___ Python tracker &

[issue42823] Incorrect frame.f_lineno when frame.f_trace is set

2021-01-06 Thread Ned Batchelder
Ned Batchelder added the comment: This change seems like it has caused a problem. Python trace functions behave as they did in Python 3.9, but C trace functions no longer get line numbers for call or return events. Running this test code: def gen(inp): for n in inp

[issue42803] Traced line number is wrong for "if not __debug__"

2021-01-02 Thread Ned Batchelder
Ned Batchelder added the comment: I think I am finding more examples of the same problem, so I will just add it here: x = "hello" try: 3/0 except ZeroDivisionError: if x == 'raise': raise ValueError() # line 6 f = 7 This show

[issue42810] Nested if/else gets phantom else trace (3.10)

2021-01-02 Thread Ned Batchelder
Ned Batchelder added the comment: This might be the same problem as #42803. -- ___ Python tracker <https://bugs.python.org/issue42810> ___ ___ Python-bugs-list m

[issue42803] Traced line number is wrong for "if not __debug__"

2021-01-02 Thread Ned Batchelder
Ned Batchelder added the comment: This might be the same problem as #42810. -- ___ Python tracker <https://bugs.python.org/issue42803> ___ ___ Python-bugs-list m

[issue42810] Nested if/else gets phantom else trace (3.10)

2021-01-02 Thread Ned Batchelder
New submission from Ned Batchelder : (Using CPython commit 6b1ac809b9) This program never executes line 6, but tracing it claims that it does: a = b = x = y = z = 1 if a == 1: if b == 1: x = 4 else: y = 6 else: z = 8 assert (a, b

[issue42803] Traced line number is wrong for "if not __debug__"

2021-01-01 Thread Ned Batchelder
New submission from Ned Batchelder : (Using CPython commit 6b1ac809b9) This program never executes line 4, but the "if not __debug__" is partly attributed to line 4, giving an incorrect trace: for value in [True, False]: if value: if not __debug__:

[issue42693] "if 0:" lines are traced; they didn't use to be

2020-12-22 Thread Ned Batchelder
Ned Batchelder added the comment: This seems like a perspective that needs a wider audience. PEP 626 says there will be no performance slowdown: > Performance Implications > > In general, there should be no change in performance. When tracing, > programs should run a little f

[issue42693] "if 0:" lines are traced; they didn't use to be

2020-12-22 Thread Ned Batchelder
Ned Batchelder added the comment: Specifically, for jumps to jumps, what is the plan? -- ___ Python tracker <https://bugs.python.org/issue42693> ___ ___ Pytho

[issue42693] "if 0:" lines are traced; they didn't use to be

2020-12-22 Thread Ned Batchelder
Ned Batchelder added the comment: Mark, I'm trying to follow along with your ideas, but it's hard to piece together the implications. Is there a way to have a discussion about where you are headed? https://github.com/python/cpython/pull/23896 "fixes" the jump to jump pr

[issue42696] Duplicated unused bytecodes at end of function

2020-12-22 Thread Ned Batchelder
Ned Batchelder added the comment: This isn't a problem for me. I noticed it and figured I'd mention it. -- ___ Python tracker <https://bugs.python.o

[issue42693] "if 0:" lines are traced; they didn't use to be

2020-12-22 Thread Ned Batchelder
Ned Batchelder added the comment: > According to that definition, there are still bugs in the optimizer relating > to jumps-to-jumps. I plan to fix them Can you say more about that? What is the bug? How will you fix it? -- ___ Python t

[issue42693] "if 0:" lines are traced; they didn't use to be

2020-12-22 Thread Ned Batchelder
Change by Ned Batchelder : -- nosy: +pablogsal ___ Python tracker <https://bugs.python.org/issue42693> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42693] "if 0:" lines are traced; they didn't use to be

2020-12-22 Thread Ned Batchelder
Ned Batchelder added the comment: Mark said: > An optimization (CS not math) is a change to the program such that it has the > same effect, according to the language spec, but improves some aspect of the > behavior, such as run time or memory use. > > Any transformation t

[issue42693] "if 0:" lines are traced; they didn't use to be

2020-12-21 Thread Ned Batchelder
Ned Batchelder added the comment: This feels like a recurring debate. I will need some time to lay out my case. Perhaps it needs a wider audience than a bpo issue? -- ___ Python tracker <https://bugs.python.org/issue42

[issue42693] "if 0:" lines are traced; they didn't use to be

2020-12-21 Thread Ned Batchelder
Ned Batchelder added the comment: > PEP 626 states that *all* executed code gets traced. Yes, but reading the PEP now, it's not clear what "executed" means. Do we mean "conceptually executed", or, "executed as compiled by the optimizing compiler"?

[issue42693] "if 0:" lines are traced; they didn't use to be

2020-12-21 Thread Ned Batchelder
Ned Batchelder added the comment: Previous versions of Python completely removed the "if 0:" statement, because it would have no effect. The condition was checked at compile time, effectively. It seems odd for 3.10 to add

[issue42696] Duplicated unused bytecodes at end of function

2020-12-20 Thread Ned Batchelder
New submission from Ned Batchelder : (Using CPython commit c95f8bc270.) This program has extra bytecodes: def f(): for i in range(10): break return 17 The dis output is: 1 0 LOAD_CONST 0 () 2 LOAD_CONST

[issue42693] "if 0:" lines are traced; they didn't use to be

2020-12-20 Thread Ned Batchelder
New submission from Ned Batchelder : (Using CPython commit c95f8bc270.) This program has an "if 0:" line that becomes a NOP bytecode. It didn't used to in Python 3.9 print(1) if 0: # line 2 print(3) print(4) Using a simple trace program (https://gi

[issue42634] Incorrect line number in bytecode for try-except-finally

2020-12-20 Thread Ned Batchelder
Ned Batchelder added the comment: (Rather: line 8 isn't executed, and so should not be traced.) -- ___ Python tracker <https://bugs.python.org/is

[issue42634] Incorrect line number in bytecode for try-except-finally

2020-12-20 Thread Ned Batchelder
Ned Batchelder added the comment: I checked on this with CPython commit c95f8bc270. The code above is fixed, but this code has a similar problem: a, b, c = 1, 1, 1 try: try: a = 4/0 # ZeroDivisionError except ValueError: b = 6 except IndexError: a

[issue42246] Implement PEP 626 -- Precise line numbers for debugging

2020-12-13 Thread Ned Batchelder
Ned Batchelder added the comment: Mark, I'm categorizing and characterizing the test failures. Here's the start of it: https://gist.github.com/nedbat/6c5dedde9df8d2de13de8a6a39a5f112 Let me know what other information would

  1   2   3   4   >