FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-132063: ProcessPoolExecutor swallows falsy Exceptions by YvesDup · Pull Request #132129 · python/cpython · GitHub

Repository navigation

gh-132063: ProcessPoolExecutor swallows falsy Exceptions - #132129

Merged
picnixz merged 11 commits into
python:mainfrom
YvesDup:ProcessPoolExecutor-swallows-flasy-exception
Apr 8, 2025
Merged

picnixz merged 11 commits into
python:mainfrom
YvesDup:ProcessPoolExecutor-swallows-flasy-exception

Conversation

YvesDup commented Apr 5, 2025 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

ProcessPoolExecutor and ThreadPoolExecutor swallows falsy exception.

Fix tests about exception variable in 2 files of /Lib/concurrent/futures

  • _base.py
  • process.py

Changes 2 tests as below:

Replace if exception: with if exception is not None:

python-cla-bot Bot commented Apr 6, 2025

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

picnixz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I never sent my review.

YvesDup commented Apr 7, 2025 •
edited
Loading

Copy link
Copy Markdown
Contributor Author

After more tests, I found that __cause__, __context__ attributes in falsey exceptions are ignored.

if (e and e.__cause__ is not None

if (e and e.__context__ is not None

And falsey BaseExceptionGroup exception is ignored too.
if e and isinstance(e, BaseExceptionGroup):

Should we open a new issue with these bugs or integrate them to this PR ?

EDIT: please ignore this comment

YvesDup and others added 3 commits April 8, 2025 14:18
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

picnixz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Some nits and LGTM.


msg = 'boolbool'
with self.assertRaisesRegex(FalseyBoolException, msg):
self.executor.submit(raiser, FalseyBoolException, msg).result()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This is for a possible follow-up but this kind of call makes me wonder whether the base class shouldn't have some def submit_and_fetch(self) method that does this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Does this method return directy the result ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

There is a follow-up with the TracebackExceptionclass which swallows __cause__ and __context__ content of falsey exceptions.
I will post a new issue about this.

picnixz enabled auto-merge (squash) April 8, 2025 14:55
picnixz added the needs backport to 3.13 only security fixes label Apr 8, 2025
picnixz merged commit 933c665 into python:main Apr 8, 2025

Copy link
Copy Markdown

Thanks @YvesDup for the PR, and @picnixz for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Apr 8, 2025
…alsey exceptions (pythonGH-132129)

(cherry picked from commit 933c665)

Co-authored-by: Duprat <yduprat@gmail.com>

bedevere-app Bot commented Apr 8, 2025

Copy link
Copy Markdown

GH-132275 is a backport of this pull request to the 3.13 branch.

bedevere-app Bot removed the needs backport to 3.13 only security fixes label Apr 8, 2025
picnixz pushed a commit that referenced this pull request Apr 8, 2025
…falsey exceptions (GH-132129) (#132275)

gh-132063: ensure that `ProcessPoolExecutor` does not swallow falsey exceptions (GH-132129)
(cherry picked from commit 933c665)

Co-authored-by: Duprat <yduprat@gmail.com>
YvesDup deleted the ProcessPoolExecutor-swallows-flasy-exception branch May 16, 2025 10:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL