Skip to content

bpo-42246: Partial implementation of PEP 626. - #23113

Merged
markshannon merged 11 commits into
python:masterfrom
markshannon:new-linetable
Nov 12, 2020
Merged

markshannon merged 11 commits into
python:masterfrom
markshannon:new-linetable

Conversation

@markshannon

@markshannon markshannon commented Nov 2, 2020 •

Copy link
Copy Markdown
Member

This PR implements the bulk of PEP 626.

  • Adds the new line number table
  • Implements the new API and exported functions.
  • Modifies the bytecode optimizer to only eliminate bytecodes if it doesn't change the line events that would occur.

https://bugs.python.org/issue42246

@markshannon

Copy link
Copy Markdown
Member Author

NOTE:
This PR needs to regenerate importlib. I'm leaving that until after review to minimize merge conflicts.

@markshannon

Copy link
Copy Markdown
Member Author

I'd like to get this merged so I can finish implementing PEP 626.
So, I'm going to merge this in a day or so if no one volunteers to review it.

@markshannon
markshannon merged commit 877df85 into python:master Nov 12, 2020
@bedevere-bot

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 RHEL8 LTO 3.x has failed when building commit 877df85.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/64/builds/441) and take a look at the build logs.
  4. Check if the failure is related to this commit (877df85) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/64/builds/441

Failed tests:

  • test_asyncio

Summary of the results of the build (if available):

==

Click to see traceback logs
remote: Enumerating objects: 3        
remote: Enumerating objects: 40, done.        
remote: Counting objects:   2% (1/40)        
remote: Counting objects:   5% (2/40)        
remote: Counting objects:   7% (3/40)        
remote: Counting objects:  10% (4/40)        
remote: Counting objects:  12% (5/40)        
remote: Counting objects:  15% (6/40)        
remote: Counting objects:  17% (7/40)        
remote: Counting objects:  20% (8/40)        
remote: Counting objects:  22% (9/40)        
remote: Counting objects:  25% (10/40)        
remote: Counting objects:  27% (11/40)        
remote: Counting objects:  30% (12/40)        
remote: Counting objects:  32% (13/40)        
remote: Counting objects:  35% (14/40)        
remote: Counting objects:  37% (15/40)        
remote: Counting objects:  40% (16/40)        
remote: Counting objects:  42% (17/40)        
remote: Counting objects:  45% (18/40)        
remote: Counting objects:  47% (19/40)        
remote: Counting objects:  50% (20/40)        
remote: Counting objects:  52% (21/40)        
remote: Counting objects:  55% (22/40)        
remote: Counting objects:  57% (23/40)        
remote: Counting objects:  60% (24/40)        
remote: Counting objects:  62% (25/40)        
remote: Counting objects:  65% (26/40)        
remote: Counting objects:  67% (27/40)        
remote: Counting objects:  70% (28/40)        
remote: Counting objects:  72% (29/40)        
remote: Counting objects:  75% (30/40)        
remote: Counting objects:  77% (31/40)        
remote: Counting objects:  80% (32/40)        
remote: Counting objects:  82% (33/40)        
remote: Counting objects:  85% (34/40)        
remote: Counting objects:  87% (35/40)        
remote: Counting objects:  90% (36/40)        
remote: Counting objects:  92% (37/40)        
remote: Counting objects:  95% (38/40)        
remote: Counting objects:  97% (39/40)        
remote: Counting objects: 100% (40/40)        
remote: Counting objects: 100% (40/40), done.        
remote: Compressing objects:   4% (1/21)        
remote: Compressing objects:   9% (2/21)        
remote: Compressing objects:  14% (3/21)        
remote: Compressing objects:  19% (4/21)        
remote: Compressing objects:  23% (5/21)        
remote: Compressing objects:  28% (6/21)        
remote: Compressing objects:  33% (7/21)        
remote: Compressing objects:  38% (8/21)        
remote: Compressing objects:  42% (9/21)        
remote: Compressing objects:  47% (10/21)        
remote: Compressing objects:  52% (11/21)        
remote: Compressing objects:  57% (12/21)        
remote: Compressing objects:  61% (13/21)        
remote: Compressing objects:  66% (14/21)        
remote: Compressing objects:  71% (15/21)        
remote: Compressing objects:  76% (16/21)        
remote: Compressing objects:  80% (17/21)        
remote: Compressing objects:  85% (18/21)        
remote: Compressing objects:  90% (19/21)        
remote: Compressing objects:  95% (20/21)        
remote: Compressing objects: 100% (21/21)        
remote: Compressing objects: 100% (21/21), done.        
remote: Total 43 (delta 22), reused 20 (delta 19), pack-reused 3        
From https://github.com/python/cpython
 * branch                  master     -> FETCH_HEAD
Reset branch 'master'

test_tk skipped -- Tk unavailable due to TclError: no display name and no $DISPLAY environment variab [...]
test_flock (__main__.FNTLEINTRTest) ... ok
test_lockf (__main__.FNTLEINTRTest) ... ok
test_read (__main__.OSEINTRTest) ... ok
test_wait (__main__.OSEINTRTest) ... ok
test_wait3 (__main__.OSEINTRTest) ... ok
test_wait4 (__main__.OSEINTRTest) ... ok
test_waitpid (__main__.OSEINTRTest) ... ok
test_write (__main__.OSEINTRTest) ... ok
test_devpoll (__main__.SelectEINTRTest) ... skipped 'need select.devpoll'
test_epoll (__main__.SelectEINTRTest) ... ok
test_kqueue (__main__.SelectEINTRTest) ... skipped 'need select.kqueue'
test_poll (__main__.SelectEINTRTest) ... ok
test_select (__main__.SelectEINTRTest) ... ok
test_sigtimedwait (__main__.SignalEINTRTest) ... ok
test_sigwaitinfo (__main__.SignalEINTRTest) ... ok
test_accept (__main__.SocketEINTRTest) ... ok
test_open (__main__.SocketEINTRTest) ... ok
test_os_open (__main__.SocketEINTRTest) ... ok
test_recv (__main__.SocketEINTRTest) ... ok
test_recvmsg (__main__.SocketEINTRTest) ... ok
test_send (__main__.SocketEINTRTest) ... ok
test_sendall (__main__.SocketEINTRTest) ... ok
test_sendmsg (__main__.SocketEINTRTest) ... ok
test_sleep (__main__.TimeEINTRTest) ... ok

----------------------------------------------------------------------
Ran 24 tests in 6.572s

OK (skipped=2)
test_winreg skipped -- No module named 'winreg'
test_msilib skipped -- No module named '_msi'
test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run
test_startfile skipped -- object <module 'os' from '/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/os.py'> has no attribute 'startfile'
test_devpoll skipped -- test works only on Solaris OS family
test_ossaudiodev skipped -- [Errno 2] No such file or directory: '/dev/dsp'
test_kqueue skipped -- test works only on BSD
test_ttk_guionly skipped -- Tk unavailable due to TclError: no display name and no $DISPLAY environment variab [...]
test_ioctl skipped -- Unable to open /dev/tty
test_winconsoleio skipped -- test only relevant on win32
test_tix skipped -- Tk unavailable due to TclError: no display name and no $DISPLAY environment variab [...]
test_winsound skipped -- No module named 'winsound'
Timeout (0:15:00)!
Thread 0x00007f6fe158d740 (most recent call first):
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/selectors.py", line 469 in select
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/asyncio/base_events.py", line 1854 in _run_once
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/asyncio/base_events.py", line 596 in run_forever
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/asyncio/base_events.py", line 629 in run_until_complete
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/test_asyncio/test_subprocess.py", line 177 in test_kill
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/case.py", line 549 in _callTestMethod
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/case.py", line 592 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/case.py", line 652 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/runner.py", line 176 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/support/__init__.py", line 959 in _run_suite
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/support/__init__.py", line 1082 in run_unittest
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/libregrtest/runtest.py", line 211 in _test_module
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/libregrtest/runtest.py", line 236 in _runtest_inner2
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/libregrtest/runtest.py", line 272 in _runtest_inner
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/libregrtest/runtest.py", line 142 in _runtest
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/libregrtest/runtest.py", line 195 in runtest
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/libregrtest/runtest_mp.py", line 81 in run_tests_worker
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/libregrtest/main.py", line 659 in _main
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/libregrtest/main.py", line 639 in main
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/libregrtest/main.py", line 717 in main
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/regrtest.py", line 43 in _main
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/regrtest.py", line 47 in <module>
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/runpy.py", line 87 in _run_code
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/runpy.py", line 197 in _run_module_as_main
Timeout (0:15:00)!
Thread 0x00007feee61dc740 (most recent call first):
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/selectors.py", line 469 in select
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/asyncio/base_events.py", line 1854 in _run_once
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/asyncio/base_events.py", line 596 in run_forever
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/asyncio/base_events.py", line 629 in run_until_complete
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/test_asyncio/test_subprocess.py", line 190 in test_terminate
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/case.py", line 549 in _callTestMethod
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/case.py", line 592 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/case.py", line 652 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/unittest/runner.py", line 176 in run
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/support/__init__.py", line 959 in _run_suite
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/support/__init__.py", line 1082 in run_unittest
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/libregrtest/runtest.py", line 211 in _test_module
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/libregrtest/runtest.py", line 236 in _runtest_inner2
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/libregrtest/runtest.py", line 272 in _runtest_inner
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/libregrtest/runtest.py", line 155 in _runtest
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/libregrtest/runtest.py", line 195 in runtest
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/libregrtest/main.py", line 319 in rerun_failed_tests
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/libregrtest/main.py", line 696 in _main
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/libregrtest/main.py", line 639 in main
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/libregrtest/main.py", line 717 in main
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/test/__main__.py", line 2 in <module>
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/runpy.py", line 87 in _run_code
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/Lib/runpy.py", line 197 in _run_module_as_main
make: *** [Makefile:1203: buildbottest] Error 1

Cannot open file '/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto/build/test-results.xml' for upload
thmo added a commit to thmo/jinja that referenced this pull request Jan 19, 2021
As part of python/cpython#23113 partly
implementing PEP 626 (see https://bugs.python.org/issue42246), the
co_lnotab member of struct PyCodeObject was replaced by co_linetable,
implementing a new line number table.

This commit therefore adds linetable to the list of attributes that
are copied over into the final CodeType executed by fake_traceback()
to ensure proper line numbers and contents in fake stack traces
generated when running under Python 3.10.

Fixes pallets#1333.
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
* Implement new line number table format, as defined in PEP 626.
Comment thread Tools/gdb/libpython.py
addr = 0
for addr_incr, line_incr in zip(co_lnotab[::2], co_lnotab[1::2]):
for addr_incr, line_incr in zip(co_linetable[::2], co_linetable[1::2]):
if addr_incr == 255:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be if ord(addr_incr) == 255

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants