Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-42246: Remove DO_NOT_EMIT_BYTECODE macros, so that while loops and if statements conform to PEP 626. #23743

Merged
merged 2 commits into from
Dec 15, 2020

Conversation

markshannon
Copy link
Member

@markshannon markshannon commented Dec 11, 2020

PEP 626 requires all expressions and statements to be traced, even if the code is redundant.
This PR does that for while and if statements.
The performance impact on while 1: loops is minimized by copying the test to the end of the loop.

while test:
     body

used to compile to:

start:
    if not test: goto end
    body
    goto start
end:

It now compiles to:

    if not test: goto end
loop:
    body
    if test goto loop
end:

which will be a tiny bit slower for while 1 loops and a bit faster for other while loops.

I'm skipping news, as this PR is part of PEP 626 and is covered by that.

https://bugs.python.org/issue42246

@@ -409,21 +409,6 @@ def f(cond1, cond2):
self.assertLessEqual(len(returns), 6)
self.check_lnotab(f)

def test_elim_jump_after_return2(self):
Copy link
Member Author

Choose a reason for hiding this comment

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

I've removed this test, as doesn't test what it claims to test. There is no dead code in

def f(cond1, cond2):
    while 1:
        if cond1: return 4

@markshannon markshannon reopened this Dec 11, 2020
@markshannon markshannon force-pushed the remove-dont-emit-macros branch from f1c4c1e to ca056d4 Compare December 14, 2020 07:15
@markshannon markshannon force-pushed the remove-dont-emit-macros branch from ca056d4 to a239d48 Compare December 14, 2020 12:47
@markshannon markshannon reopened this Dec 14, 2020
@markshannon markshannon added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Dec 14, 2020
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @markshannon for commit c15f5ab 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Dec 14, 2020
@markshannon
Copy link
Member Author

The three failures are, in order:

  • An asyncio test timeout. Comments about the reliability of asyncio are for another issue.
  • A pre-existing failure.
  • Missing symbols in LTO, possibly caused by a (wrong) warning about buffer overflow when resizing a bytes object.

No leaks, or real failures, so I'm merging.

@markshannon markshannon merged commit 8473cf8 into python:master Dec 15, 2020
@bedevere-bot
Copy link

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

Hi! The buildbot aarch64 RHEL7 3.x has failed when building commit 8473cf8.

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/539/builds/421) and take a look at the build logs.
  4. Check if the failure is related to this commit (8473cf8) 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/539/builds/421

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

== Tests result: ENV CHANGED ==

412 tests OK.

10 slowest tests:

  • test_concurrent_futures: 4 min 22 sec
  • test_unparse: 4 min 9 sec
  • test_tokenize: 3 min 34 sec
  • test_capi: 3 min 10 sec
  • test_peg_generator: 3 min
  • test_asyncio: 3 min
  • test_multiprocessing_spawn: 2 min 50 sec
  • test_lib2to3: 2 min 15 sec
  • test_multiprocessing_forkserver: 1 min 24 sec
  • test_nntplib: 1 min 22 sec

1 test altered the execution environment:
test_asyncio

13 tests skipped:
test_devpoll test_ioctl test_kqueue test_msilib test_ossaudiodev
test_startfile test_tix test_tk test_ttk_guionly test_winconsoleio
test_winreg test_winsound test_zipfile64

Total duration: 7 min 13 sec

Click to see traceback logs
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-aarch64/build/Lib/asyncio/sslproto.py", line 321, in __del__
    self.close()
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-aarch64/build/Lib/asyncio/sslproto.py", line 316, in close
    self._ssl_protocol._start_shutdown()
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-aarch64/build/Lib/asyncio/sslproto.py", line 590, in _start_shutdown
    self._abort()
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-aarch64/build/Lib/asyncio/sslproto.py", line 731, in _abort
    self._transport.abort()
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-aarch64/build/Lib/asyncio/selector_events.py", line 680, in abort
    self._force_close(None)
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-aarch64/build/Lib/asyncio/selector_events.py", line 731, in _force_close
    self._loop.call_soon(self._call_connection_lost, exc)
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-aarch64/build/Lib/asyncio/base_events.py", line 745, in call_soon
    self._check_closed()
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-aarch64/build/Lib/asyncio/base_events.py", line 510, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
gvanrossum added a commit that referenced this pull request Dec 4, 2021
(The function this described was deleted by PR #23743, the comment was accidentally retained.)
gvanrossum added a commit that referenced this pull request Dec 5, 2021
(The function this described was deleted by PR #23743, the comment was accidentally retained.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants