-
-
Notifications
You must be signed in to change notification settings - Fork 497
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
Declare Python 3.13 as supported in sagelib #39188
base: develop
Are you sure you want to change the base?
Conversation
Needs ipython/ipykernel@b47db6f applied to ipykernel to fix some test failures due to deprecation warnings. Not sure if it's worth to filter out the warnings in Sage |
Documentation preview for this PR (built with commit 335b6dd; changes) is ready! 🎉 |
Nice, thanks for working this out. It's very useful. I'm currently working on updating sagemath to 10.5 on python 3.13, I'll report here when I'm done. |
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.
Could you please also make similar changes to the pyproject.toml
in the root? (I can do this also separately if you prefer.)
9c9264d
to
335b6dd
Compare
I'm testing with sagemath 10.5 + the 6 PRs listed here, and I'm getting some test failures when running tests in parallel which seem to indicate some concurrency issues. For instance:
Has anyone seen this? I think what happens is:
If I run the whole testsuite in non-parallel mode, everything seems to work fine (then I'm just left with a couple of unrelated failures). If I disable the There is this |
Two questions on procedure:
|
Right, |
Ok, the new behaviour of python 3.13 for some reason causes the One workaround is to use I'll prepare a draft PR but here are some questions for @orlitzky:
This is what I have in mind: --- a/src/sage/misc/temporary_file.py
+++ b/src/sage/misc/temporary_file.py
@@ -540,7 +540,5 @@ def spyx_tmp() -> str:
if _spyx_tmp:
return _spyx_tmp
- d = tempfile.TemporaryDirectory()
- _spyx_tmp = os.path.join(d.name, 'spyx')
- atexit.register(lambda: d.cleanup())
+ _spyx_tmp = tmp_dir(name='spyx_')
return _spyx_tmp |
For some reason, a new behaviour of python 3.13 [0] causes the `TemporaryDirectory()` in `sage.misc.temporary_file.spyx_tmp()` to be deleted on child exit, which causes trouble with parallel doctesting [1]. We rewrite `spyx_tmp()` using `tmp_dir()`, which doesn't have this problem, see [2]. [0] python/cpython#114279 [1] sagemath#39188 (comment) [2] sagemath#39188 (comment)
I'm trying (infrequently) to get rid of But for
Otherwise it may not be cleaned up at all? sage-cleaner might do it too (I don't remember) but if you are calling sage functions from python code you won't have sage-cleaner.
No. |
Makes sense. It still seems nice to have a "parent" temporary directory where everything is placed, and easier to clean up at once if everything else fails. But sure, for many purposes the temporary files should be short lived.
Ok, this is what is broken with python 3.13 and (hopefully) fixed by #39201. The issue seems to be that the
But python itself will clean it up on exit. That's what the manual claims, and that's what I see. I'm sure there are exceptional circumstances that will skip this clean up, but most likely those exceptional circumstances will also skip the atexit handler. In any case, I guess there's no harm on keeping the atexit handler, except in ths sense that having it there gives the false impression that the directory will not be cleaned up otherwise.
Will do then. |
For some reason, a new behaviour of python 3.13 [0] causes the `TemporaryDirectory()` in `sage.misc.temporary_file.spyx_tmp()` to be deleted on child exit, which causes trouble with parallel doctesting [1]. We rewrite `spyx_tmp()` using `tmp_dir()`, which doesn't have this problem, see [2]. [0] python/cpython#114279 [1] sagemath#39188 (comment) [2] sagemath#39188 (comment)
You are right, but I didn't know it at the time. What the documentation actually says is,
Surely python objects are destroyed when the process exits, right? Actually, no:
However, at least in python-3.12, |
⌛ Dependencies
spyx_tmp()
cleanup. #39201