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
commented
Mar 28, 2025
•
edited by brandtbucher
Loading
Uh oh!
There was an error while loading. Please reload this page.
Guard is unnecessary if we already know the value's type.
@brandtbucher
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
Also, I'm changing the issue number to GH-131798, since that fits better.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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
|
Thanks, @brandtbucher!
I submitted the style changes (my auto-formatter is eager, sorry). Created a NEWS entry too.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
Stats look good. Looks like we're removing 25% of our str checks!
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
⚠️⚠️⚠️ 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:
- Don't panic.
- Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
- 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.
- Check if the failure is related to this commit (685fd74) or if it is a false positive.
- 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
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
Fidget-Spinner
Awaiting requested review from Fidget-Spinner
Fidget-Spinner is a code owner
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
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.
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.
|