GeezerVison is showing github.com — GH-119169: Simplify `os.walk()` exception handling by barneygale · Pull Request #121435 · python/cpython
Conversation
barneygale
commented
Jul 6, 2024
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Handle errors from os.scandir() and ScandirIterator similarly, which lets us loop over directory entries with for.
$ ./python -m timeit -s 'import os' 'list(os.walk("."))'
5 loops, best of 5: 41.5 msec per loop
5 loops, best of 5: 40.1 msec per loop
# --> 3.5% faster
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Handle errors from `os.scandir()` and `ScandirIterator` similarly, which
lets us loop over directory entries with `for`.
barneygale
changed the title
GH-119186: Simplify os.walk() exception handling
GH-119169: Simplify os.walk() exception handling
Jul 6, 2024
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.
LGTM.
This is not so much optimization as simplification.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
barneygale reacted with heart emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️
Hi! The buildbot AMD64 RHEL8 LTO + PGO 3.x has failed when building commit db00fee.
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/all/#builders/568/builds/6911) and take a look at the build logs.
- Check if the failure is related to this commit (db00fee) 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/all/#builders/568/builds/6911
Failed tests:
Failed subtests:
- test_with_statement_QUIT_failure - test.test_smtplib.SMTPSimTests.test_with_statement_QUIT_failure
- test_with_statement - test.test_smtplib.SMTPSimTests.test_with_statement
Summary of the results of the build (if available):
==
Click to see traceback logs
Traceback (most recent call last):
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto-pgo/build/Lib/test/test_smtplib.py", line 1243, in test_with_statement_QUIT_failure
smtp.noop()
~~~~~~~~~^^
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto-pgo/build/Lib/smtplib.py", line 523, in noop
return self.docmd("noop")
~~~~~~~~~~^^^^^^^^
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto-pgo/build/Lib/smtplib.py", line 430, in docmd
return self.getreply()
~~~~~~~~~~~~~^^
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto-pgo/build/Lib/smtplib.py", line 403, in getreply
raise SMTPServerDisconnected("Connection unexpectedly closed")
smtplib.SMTPServerDisconnected: Connection unexpectedly closed
Traceback (most recent call last):
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto-pgo/build/Lib/test/test_smtplib.py", line 1233, in test_with_statement
code, message = smtp.noop()
~~~~~~~~~^^
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto-pgo/build/Lib/smtplib.py", line 523, in noop
return self.docmd("noop")
~~~~~~~~~~^^^^^^^^
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto-pgo/build/Lib/smtplib.py", line 430, in docmd
return self.getreply()
~~~~~~~~~~~~~^^
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64.lto-pgo/build/Lib/smtplib.py", line 403, in getreply
raise SMTPServerDisconnected("Connection unexpectedly closed")
smtplib.SMTPServerDisconnected: Connection unexpectedly closed
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️
Hi! The buildbot AMD64 RHEL8 FIPS Only Blake2 Builtin Hash 3.x has failed when building commit db00fee.
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/all/#builders/469/builds/8522) and take a look at the build logs.
- Check if the failure is related to this commit (db00fee) 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/all/#builders/469/builds/8522
Failed tests:
Failed subtests:
- test_with_statement_QUIT_failure - test.test_smtplib.SMTPSimTests.test_with_statement_QUIT_failure
- test_with_statement - test.test_smtplib.SMTPSimTests.test_with_statement
Summary of the results of the build (if available):
==
Click to see traceback logs
Traceback (most recent call last):
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-fips-x86_64.no-builtin-hashes-except-blake2/build/Lib/test/test_smtplib.py", line 1243, in test_with_statement_QUIT_failure
smtp.noop()
~~~~~~~~~^^
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-fips-x86_64.no-builtin-hashes-except-blake2/build/Lib/smtplib.py", line 523, in noop
return self.docmd("noop")
~~~~~~~~~~^^^^^^^^
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-fips-x86_64.no-builtin-hashes-except-blake2/build/Lib/smtplib.py", line 430, in docmd
return self.getreply()
~~~~~~~~~~~~~^^
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-fips-x86_64.no-builtin-hashes-except-blake2/build/Lib/smtplib.py", line 403, in getreply
raise SMTPServerDisconnected("Connection unexpectedly closed")
smtplib.SMTPServerDisconnected: Connection unexpectedly closed
Traceback (most recent call last):
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-fips-x86_64.no-builtin-hashes-except-blake2/build/Lib/test/test_smtplib.py", line 1233, in test_with_statement
code, message = smtp.noop()
~~~~~~~~~^^
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-fips-x86_64.no-builtin-hashes-except-blake2/build/Lib/smtplib.py", line 523, in noop
return self.docmd("noop")
~~~~~~~~~~^^^^^^^^
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-fips-x86_64.no-builtin-hashes-except-blake2/build/Lib/smtplib.py", line 430, in docmd
return self.getreply()
~~~~~~~~~~~~~^^
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-fips-x86_64.no-builtin-hashes-except-blake2/build/Lib/smtplib.py", line 403, in getreply
raise SMTPServerDisconnected("Connection unexpectedly closed")
smtplib.SMTPServerDisconnected: Connection unexpectedly closed
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
estyxx
pushed a commit
to estyxx/cpython
that referenced
this pull request
Jul 17, 2024
Handle errors from `os.scandir()` and `ScandirIterator` similarly, which
lets us loop over directory entries with `for`.
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.
|