Skip to content

Maintain compatibility with CPython 3.13 #1242

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

daskol
Copy link

@daskol daskol commented Mar 27, 2025

See changes in Python C API in CPython 3.13 changelog. Initial discussion is in AUR.

@medaminezghal
Copy link

medaminezghal commented Mar 28, 2025

@daskol You need to edit the files that use asyncore (Removed in python 3.13) to make it use asyncio
This what I did in the prepare function in PKGBUILD file:

    sed -i 's/_try_asyncore_import/_try_asyncio_import/g' cassandra/cluster.py
    sed -i 's/from cassandra.io.asyncorereactor import AsyncoreConnection/from cassandra.io.asyncioreactor import AsyncioConnection/g' cassandra/cluster.py
    sed -i 's/from cassandra.io.asyncorereactor import AsyncoreConnection/from cassandra.io.asyncioreactor import AsyncioConnection/g' tests/integration/long/test_ipv6.py
    sed -i 's/(AsyncoreConnection,None)/(AsyncioConnection,None)/g' cassandra/cluster.py
    sed -i '/import asynctest/d' tests/unit/io/test_asyncioreactor.py
    sed -i 's/asynctest.TestSelector()/AsyncMock()/g' tests/unit/io/test_asyncioreactor.py
    sed -i '/from unittest.mock import patch/a from unittest.mock import AsyncMock' tests/unit/io/test_asyncioreactor.py

Maybe be you could edit the files to use asyncore or asyncio by case (python>=3.13 or not)

@medaminezghal
Copy link

@daskol and even after I edit for some reason I can't import the cassandra.io.libevwrapper

@daskol
Copy link
Author

daskol commented Mar 28, 2025

@medaminezghal What about cqlsh utility? It does not work without this fix because of missing cp313 wheels.

@medaminezghal
Copy link

@daskol if you build the package without the C extensions it should work (of course after editing the files that use asyncore) and then you can build cqlsh in python 3.13

@medaminezghal
Copy link

medaminezghal commented Mar 28, 2025

@daskol you can replace any code that use asyncore with asyncio safely https://docs.python.org/3/library/asyncore.html

@daskol
Copy link
Author

daskol commented Mar 28, 2025

Do pacman -S python-pyasyncore or pip install pyasyncore solve your issue? Initially, I faced with the issue of missing cp313 wheels and build failure of this dreiver from scratch.

@medaminezghal
Copy link

I think it’s not useful to use unmaintained package as provided in the description. So it’s better to use asyncio

@medaminezghal
Copy link

@daskol I think you need to fix the problem related to this issue from other project.
There is only 1 file that use asynctest package.
Also the distutils (used to build the C extensions) is deprecated and will be removed soon.

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.

2 participants