Skip to content
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 Python 3.13 CI #587

Merged
merged 47 commits into from
Sep 25, 2024
Merged

Add Python 3.13 CI #587

merged 47 commits into from
Sep 25, 2024

Conversation

waahm7
Copy link
Contributor

@waahm7 waahm7 commented Aug 22, 2024

  • Adds CI for Python 3.13
  • Updated CD Pipeline to use Python 3.13 stable API due to deprecated function
  • Moves our CI from hard coded creds to temporary creds
  • Fixes some MQTT tests that were relying on hard coded creds in the environment.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Comment on lines 275 to 283
#if PY_VERSION_HEX >= 0x030D0000 /* Check if Python version is 3.13 or higher */
if (PyWeakref_GetRef(py_connection->self_proxy, &self) < 0) { /* strong reference */
PyErr_WriteUnraisable(PyErr_Occurred());
goto on_done;
}
#else
/* PyWeakref_GetObject is deprecated since python 3.13 */
self = PyWeakref_GetObject(py_connection->self_proxy); /* borrowed reference */
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

the logic is copy/pasted a lot of time. How about backporting PyWeakref_GetRef to older versions

module.h:

#if PY_VERSION_HEX < 0x30D0000
// PyWeakref_GetRef() was added in Python3.13, make it available in older versions
int PyWeakref_GetRef(PyObject *ref, PyObject **pobj);
#endif

module.c:

#if PY_VERSION_HEX < 0x30D0000
// PyWeakref_GetRef() was added in Python3.13, make it available in older versions
int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
    ...
}
#endif

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if we can backport it. PyWeakref_GetRef depends upon the internal function _PyWeakref_GetRef, which is probably located at https://fossies.org/linux/misc/Python-3.13.0rc2.tar.xz/Python-3.13.0rc2/Include/internal/pycore_weakref.h, and that function also depends upon several internal functions.

We can potentially add PyWeakref_GetRef, which calls PyWeakref_GetObject and also increments the ref count, so that we can avoid the copy-paste.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, updated. I have created a new function which abstracts the differences between APIs into a single place, and we don't need to do any code duplication. I didn't define PyWeakref_GetRef for pre-Python 3.13 because I thought it would be confusing for future readers that we are calling the Python 3.13+ function, and having our own definition for pre-Python 3.13 which does something slightly different.

continuous-delivery/build-wheels-manylinux2014-x86_64.sh Outdated Show resolved Hide resolved
continuous-delivery/build-wheels-manylinux2014-aarch64.sh Outdated Show resolved Hide resolved
continuous-delivery/build-wheels-musllinux-1-1-aarch64.sh Outdated Show resolved Hide resolved
continuous-delivery/build-wheels-musllinux-1-1-x86_64.sh Outdated Show resolved Hide resolved
continuous-delivery/build-wheels-osx.sh Outdated Show resolved Hide resolved
setup.py Show resolved Hide resolved
setup.py Show resolved Hide resolved
setup.py Show resolved Hide resolved
source/module.c Outdated Show resolved Hide resolved
source/module.c Outdated Show resolved Hide resolved
@waahm7 waahm7 requested a review from graebm September 24, 2024 16:49
@graebm graebm changed the title Add Pyhon 3.13 CI Add Python 3.13 CI Sep 24, 2024
AWS_FATAL_ASSERT if these functions raise a python exception (which we never checked for before)
I'm worried about introducing crashes
@waahm7 waahm7 merged commit 536446a into main Sep 25, 2024
71 checks passed
@waahm7 waahm7 deleted the python3.13 branch September 25, 2024 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants