-
Notifications
You must be signed in to change notification settings - Fork 893
ci: enable more tests on 3.14t #5524
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
Conversation
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 just had one minor question and comment but otherwise this looks great. A few other comments too.
| let instance = Py::new(py, ReleaseBufferError {}).unwrap(); | ||
| let env = [("ob", instance.clone_ref(py))].into_py_dict(py).unwrap(); | ||
|
|
||
| assert!(capture.borrow(py).capture.is_none()); |
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.
It's not obvious to me why this got deleted, any particular reason? There's a similar pattern in test_exceptions.rs below.
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.
Hmm it was just awkward to assert that the unraisable hook hadn't been called yet.
I've found a better pattern where the closure gets access to the hook so it can retrieve the value, will push that and restore this.
| assert_eq!(err.to_string(), "ValueError: oh dear"); | ||
| assert!(object.is(&instance)); | ||
|
|
||
| capture.borrow_mut(py).uninstall(py); |
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.
even without the locking the new API is nicer without this explicit uninstall step.
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.
Agreed, much less error prone.
| // On the free-threaded build, dropping an object on its non-origin thread | ||
| // will not immediately drop it because the refcounts need to be merged. | ||
| // | ||
| // Force GC to ensure the drop happens now on the wrong thread. | ||
| py.run(c_str!("import gc; gc.collect()"), None, None) | ||
| .unwrap(); |
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.
In hindsight this should have been obvious why this test was failing; for a while I was worried it was a refcounting bug on PyO3's end.
Expands the test suite on Python 3.14t:
sys.unraisablehook, as it's a global variable, and enable them allwarnings.capture_wanings, as it's thread-safe on 3.14t