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 — [3.14] gh-135427: Fix DeprecationWarning for os.fork when run in threads with -Werror (GH-136796) by gpshead · Pull Request #140191 · python/cpython

Conversation

@gpshead

@gpshead gpshead commented Oct 16, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

cherry-pick fd8f42d for a backport to 3.14

Don't ignore errors raised by PyErr_WarnFormat in warn_about_fork_with_threads Instead, ignore the warnings in all test code that forks. (That's a lot of functions.)

In test_support, make ignore_warnings a context manager (as well as decorator), and add a message argument to it.
Also add a ignore_fork_in_thread_deprecation_warnings helper for the deadlock-in-fork warning.

  • Issue: -Werror doesn't error out on DeprecationWarning for os.fork() #135427

Sorry, something went wrong.

Uh oh!

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

All reactions
@rani-pinchuk @gpshead
pythongh-135427: Fix DeprecationWarning for os.fork when run in threa…
b02aefc
…ds with -Werror (pythonGH-136796)

Don't ignore errors raised by `PyErr_WarnFormat` in `warn_about_fork_with_threads`
Instead, ignore the warnings in all test code that forks. (That's a lot of functions.)

In `test_support`, make `ignore_warnings` a context manager (as well as decorator),
and add a `message` argument to it.
Also add a `ignore_fork_in_thread_deprecation_warnings` helper for the deadlock-in-fork
warning.
This was referenced Oct 16, 2025
-Werror doesn't error out on DeprecationWarning for os.fork() #135427
Closed
gh-135427: Fix DeprecationWarning for os.fork when run in threads with -Werror #136796
Merged
@gpshead
gpshead marked this pull request as ready for review October 16, 2025 04:30
@gpshead
gpshead requested review from a team, 1st1, asvetlov, kumaraditya303, rhettinger, vsajip and willingc as code owners October 16, 2025 04:30
@bedevere-app bedevere-app Bot added the awaiting core review label Oct 16, 2025
@gpshead gpshead added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 16, 2025
@bedevere-bot

bedevere-bot commented Oct 16, 2025

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @gpshead for commit b02aefc 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F140191%2Fmerge

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

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 16, 2025
@gpshead gpshead assigned encukou Oct 16, 2025
@encukou

encukou commented Oct 16, 2025

Copy link
Copy Markdown
Member

Should we backport this?

Warnings changes in patch releases make it harder to update, and from comments like #135427 (comment) it sounds like it's important to fix this now.

But, if you think it should get a backport, let's do it :)

All reactions

Sorry, something went wrong.

Uh oh!

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

@gpshead

gpshead commented Oct 17, 2025

Copy link
Copy Markdown
Member Author

I don't think this one is actually urgent to backport. I'll close this, the PR is ready and can be resurrected if deemed important.

So -Werror doesn't turn it into an error in 3.14 but we've fixed that in 3.15? good enough. This is an odd warning - it'll probably never become an error because our detection can only ever be best effort (it cannot be guaranteed to detect if other threads exist), it's more of the best way to surface an application design flaw to users.

encukou reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@gpshead gpshead closed this Oct 17, 2025
@gpshead gpshead mentioned this pull request Nov 16, 2025
[3.14] gh-137109: refactor warning about threads when forking (GH-141438) #141614
Merged
@A5rocks

A5rocks commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

^^; one reference point is that I ran into this new error on a test suite on 3.15, and the issue was that the test suite had -Werror and so didn't see the fork + threads thing earlier. I got very confused, since I knew the DeprecationError wasn't added in 3.15! But now I've figured it out, so no harm done.

All reactions

Sorry, something went wrong.

Uh oh!

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@rhettinger rhettinger Awaiting requested review from rhettinger rhettinger is a code owner
@vsajip vsajip Awaiting requested review from vsajip vsajip is a code owner
@1st1 1st1 Awaiting requested review from 1st1 1st1 is a code owner
@asvetlov asvetlov Awaiting requested review from asvetlov asvetlov is a code owner
@kumaraditya303 kumaraditya303 Awaiting requested review from kumaraditya303 kumaraditya303 is a code owner
@willingc willingc Awaiting requested review from willingc willingc is a code owner

Uh oh!

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

Assignees

@encukou encukou

Labels

awaiting core review

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.

5 participants

@gpshead @bedevere-bot @encukou @A5rocks @rani-pinchuk
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 01402520 — 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.