Skip to content

Conversation

@crusaderky
Copy link
Contributor

@crusaderky crusaderky commented Sep 26, 2025

Mark the project as compatible with free-threading.

Stress-test the whole test suite (and, crucially, _speedups.so) by running it in parallel over multiple threads.
This aims to detect race conditions where functions may share a thread-unsafe global state.
Namely, in the future one may add a global cache, which carries thread-safety concerns.

@crusaderky crusaderky marked this pull request as ready for review September 26, 2025 11:00
pyproject.toml Outdated
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: Free Threading :: 2 - Beta",
Copy link
Member

Choose a reason for hiding this comment

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

Why is this "beta"? Why not "stable" or "resilient"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, please refer to this: https://py-free-threading.github.io/porting/#define-and-document-thread-safety-guarantees

  1. Alpha - For experimentation and feedback only.
  2. Beta - Free threaded usage is supported, but documentation of constraints and limitations may be incomplete.
  3. Stable - Supported for production use, multithreaded use is tested, and thread safety issues are clearly documented.
  4. Resilient - Fully supported and fully thread safe.

In general, I would not go beyond Beta status before having some feedback that everything works well in production environments.

@davidism
Copy link
Member

davidism commented Sep 27, 2025

I'm going to remove the classifier for now. I don't understand free threading enough to evaluate the "Beta", "Stable", and "Resilient" classifiers. Our intention is to support free threading, if we don't then that's a bug to report and help fix. We're such a simple extension that I don't think we needed to do anything to become thread safe.

The fact that we supply wheels for free threaded builds signals our support, as well as the fact that we build successfully as reported by https://ft-checker.com/?search=markupsafe. And these parallel tests pass as well.

@davidism davidism added this to the 3.0.3 milestone Sep 27, 2025
@davidism davidism merged commit 7e4e6ce into pallets:stable Sep 27, 2025
14 checks passed
@crusaderky crusaderky deleted the pytest-run-parallel branch September 29, 2025 13:52
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants