-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Python 3.13 #49970
base: master
Are you sure you want to change the base?
Add support for Python 3.13 #49970
Conversation
This code has been dropped from Python 3.13, but we depend on FieldStorage as part of the request API. The easiest option here is to directly import the code that we are already using (the last version on the 3.12 branch, but with the deprecation warning removed), along with a copy of the PSF License which covers the cgi module code.
…ck API This is required since the logging module started using the lock as a context manager, and calling the acquire and release methods.
Remove code only needed for Python < 3.4 and ensure that we always use the spawn form of multiprocessing to avoid problems with fork and locks.
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.
I wonder if we should also vendor the cgi tests, for the sake of any changes we make to it?
Just adding this to the excludes doesn't work, because we still check the imported code.
Lightly modified from the version in Python 3.12 as follows: * Inlined check__all__ function * Converted the use of ignore_warnings helper to use warning module directly
This is no longer support in Python 3.13, and no longer required for Python>=3.8
I mildly regret doing this given that some changes were needed to make the tests themselves compatible with multiple Python versions, but done :) The Azure test failures are:
So I think this could land if no further changes are requested. |
@@ -90,6 +90,21 @@ def emit(self, record): | |||
self.queue.put(data) | |||
|
|||
|
|||
|
|||
class NullLock: |
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.
Given this is brand new code, can we please actually add types for all of this? This should, I think, match: https://github.com/python/typeshed/blob/614e9499f145e9dccade16d906247276f1d5e6aa/stdlib/_thread.pyi#L16-L20
Can we also add a comment saying that this implements the interface of threading.RLock
, and probably rename this to NullRLock
, to clarify this doesn't match threading.Lock
?
Notably this involves vendoring a copy of the removed cgi module from stdlib.