GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GH-131798: Remove guard for known type in TO_BOOL_STR by fluhus · Pull Request #131816 · python/cpython

Conversation

@fluhus

@fluhus fluhus commented Mar 28, 2025 •
edited by brandtbucher
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Guard is unnecessary if we already know the value's type.

@brandtbucher

  • Issue: Better uop coverage in the JIT optimizer #131798

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
fluhus added 5 commits March 26, 2025 11:45
@fluhus
Break down TO_BOOL_STR into guard and to-bool
ddcb309
@fluhus
Merge branch 'python:main' into amit
be138d0
@fluhus
Fix optimizer TO_BOOL_STR
e1f788a
@fluhus
Add test for optimizer TOS string guard removal
64aa8eb
@fluhus
Merge branch 'python:main' into amit
5f06e7f
@fluhus
fluhus requested review from Fidget-Spinner and markshannon as code owners March 28, 2025 00:59
@bedevere-app bedevere-app Bot added the awaiting review label Mar 28, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Mar 28, 2025
Better constant narrowing in the JIT optimizer #130415
Closed
13 of 17 tasks
brandtbucher
brandtbucher approved these changes Mar 28, 2025
View reviewed changes

@brandtbucher brandtbucher left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Looks good, just some style nitpicks. Can you also add a NEWS entry?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Python/bytecodes.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Python/bytecodes.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Python/bytecodes.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Python/bytecodes.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Mar 28, 2025
@brandtbucher

brandtbucher commented Mar 28, 2025

Copy link
Copy Markdown
Member

Also, I'm changing the issue number to GH-131798, since that fits better.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@brandtbucher brandtbucher changed the title gh-130415: Remove guard for known type in TO_BOOL_STR GH-131798: Remove guard for known type in TO_BOOL_STR Mar 28, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Mar 28, 2025
Better uop coverage in the JIT optimizer #131798
Open
fluhus and others added 2 commits March 28, 2025 11:41
@fluhus
Style fixes in TO_BOOL_STR
7487669
@blurb-it
📜🤖 Added by blurb_it.
6db1a79
@fluhus

fluhus commented Mar 28, 2025

Copy link
Copy Markdown
Contributor Author

Thanks, @brandtbucher!
I submitted the style changes (my auto-formatter is eager, sorry). Created a NEWS entry too.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

brandtbucher
brandtbucher reviewed Mar 28, 2025
View reviewed changes
Comment thread Python/optimizer_bytecodes.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

fluhus added 2 commits March 29, 2025 08:43
@fluhus
Remove unneeded type assignment in _GUARD_TOS_UNICODE
138f037
@fluhus
Move type assignment from _TO_BOOL_STR to _GUARD_TOS_UNICODE
42ca29c
@brandtbucher

brandtbucher commented Mar 30, 2025

Copy link
Copy Markdown
Member

Stats look good. Looks like we're removing 25% of our str checks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@brandtbucher
brandtbucher merged commit 685fd74 into python:main Mar 30, 2025
@bedevere-app bedevere-app Bot removed the awaiting merge label Mar 30, 2025
@bedevere-bot

bedevere-bot commented Mar 31, 2025

Copy link
Copy Markdown

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

Hi! The buildbot ARM64 MacOS M1 Refleaks NoGIL 3.x (tier-2) has failed when building commit 685fd74.

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/#/builders/1368/builds/2906) and take a look at the build logs.
  4. Check if the failure is related to this commit (685fd74) 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/#/builders/1368/builds/2906

Failed tests:

  • test_import
  • test.test_concurrent_futures.test_interpreter_pool

Failed subtests:

  • test_free_reference - test.test_concurrent_futures.test_interpreter_pool.InterpreterPoolExecutorTest.test_free_reference

Test leaking resources:

  • test_events: references
  • test_import: memory blocks
  • test_import: references

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

==

Click to see traceback logs
TracebackTests.test_nonexistent_module_nested) ... ok


TracebackTests.test_broken_parent_from) ... ok


TracebackTests.test_unencodable_filename) ... skipped 'need TESTFN_UNENCODABLE'


Traceback (most recent call last):
  File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/concurrent/futures/thread.py", line 99, in _worker
    ctx.initialize()
    ~~~~~~~~~~~~~~^^
  File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/concurrent/futures/interpreter.py", line 132, in initialize
    self.interpid = _interpreters.create(reqrefs=True)
                    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
interpreters.InterpreterError: interpreter creation failed
Timeout (0:45:00)!
Thread 0x0000000173dcb000 (most recent call first):
  File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/concurrent/futures/thread.py", line 116 in _worker
  File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/threading.py", line 996 in run
  File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/threading.py", line 1054 in _bootstrap_inner
  File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/threading.py", line 1016 in _bootstrap


TracebackTests.test_broken_submodule) ... ok


TracebackTests.test_broken_parent) ... ok


TracebackTests.test_exec_failure) ... ok


TracebackTests.test_exec_failure_nested) ... ok


TracebackTests.test_nonexistent_module) ... ok


TracebackTests.test_syntax_error) ... ok


Traceback (most recent call last):
  File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/concurrent/futures/thread.py", line 99, in _worker
    ctx.initialize()
    ~~~~~~~~~~~~~~^^
  File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/concurrent/futures/interpreter.py", line 132, in initialize
    self.interpid = _interpreters.create(reqrefs=True)
                    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
interpreters.InterpreterError: interpreter creation failed


TracebackTests.test_broken_from) ... ok


TracebackTests.test_import_bug) ... ok


Traceback (most recent call last):
  File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/threading.py", line 1054, in _bootstrap_inner
    self.run()
    ~~~~~~~~^^
  File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/threading.py", line 996, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/concurrent/futures/thread.py", line 104, in _worker
    executor._initializer_failed()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/concurrent/futures/thread.py", line 252, in _initializer_failed
    work_item.future.set_exception(self.BROKEN(self._broken))
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/concurrent/futures/_base.py", line 553, in set_exception
    raise InvalidStateError('{}: {!r}'.format(self._state, self))
concurrent.futures._base.InvalidStateError: CANCELLED: <Future at 0x200008e3680 state=cancelled>
ERROR


Traceback (most recent call last):
  File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/test/test_concurrent_futures/executor.py", line 200, in test_free_reference
    for obj in self.executor.map(make_dummy_object, range(10)):
               ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/concurrent/futures/_base.py", line 639, in result_iterator
    yield _result_or_cancel(fs.pop())
          ~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/concurrent/futures/_base.py", line 311, in _result_or_cancel
    return fut.result(timeout)
           ~~~~~~~~~~^^^^^^^^^
  File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/concurrent/futures/_base.py", line 450, in result
    return self.__get_result()
           ~~~~~~~~~~~~~~~~~^^
  File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/concurrent/futures/_base.py", line 395, in __get_result
    raise self._exception
concurrent.futures.interpreter.BrokenInterpreterPool: A thread initializer failed, the thread pool is not usable anymore


Traceback (most recent call last):
  File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/concurrent/futures/thread.py", line 99, in _worker
    ctx.initialize()
    ~~~~~~~~~~~~~~^^
  File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/concurrent/futures/interpreter.py", line 132, in initialize
    self.interpid = _interpreters.create(reqrefs=True)
                    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
interpreters.InterpreterError: interpreter creation failed
Warning -- Uncaught thread exception: InvalidStateError
Exception in thread ThreadPoolExecutor-109_4:
RuntimeError: Failed to import encodings module


Traceback (most recent call last):
  File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/asyncio/selector_events.py", line 873, in __del__
    _warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
ResourceWarning: unclosed transport <_SelectorSocketTransport fd=7>
Warning -- Unraisable exception
Exception ignored while calling deallocator <function _SSLProtocolTransport.__del__ at 0x200020e55d0>:
Traceback (most recent call last):
  File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/asyncio/sslproto.py", line 123, in __del__
    _warnings.warn(
ResourceWarning: unclosed transport <asyncio._SSLProtocolTransport object>
Warning -- Unraisable exception
Exception ignored while finalizing socket <socket.socket fd=7, family=2, type=1, proto=0, laddr=('127.0.0.1', 59335), raddr=('127.0.0.1', 59336)>:
Traceback (most recent call last):
  File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/test/support/__init__.py", line 814, in gc_collect
    gc.collect()
ResourceWarning: unclosed <socket.socket fd=7, family=2, type=1, proto=0, laddr=('127.0.0.1', 59335), raddr=('127.0.0.1', 59336)>
k
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@fluhus
fluhus deleted the amit branch May 5, 2025 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@brandtbucher brandtbucher brandtbucher approved these changes
@Fidget-Spinner Fidget-Spinner Awaiting requested review from Fidget-Spinner Fidget-Spinner is a code owner
@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@fluhus @brandtbucher @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.