dabeaz / curio

Good Curio!
Other
4.01k stars 240 forks source link

Python 3.12 #361

Closed carlwgeorge closed 9 months ago

carlwgeorge commented 11 months ago

Hello, I'm the Fedora package maintainer for curio. Fedora Rawhide has updated to Python 3.12, which alerted me to the fact that curio doesn't build with Python 3.12. I was preparing some fixes for a pull request, but then noticed your contributing file. If you would like the fixes let me know and I'd be happy to submit them.

There are two issues that I can see.

multiprocessing.connection constants

ImportError while loading conftest '/home/carl/development/curio/tests/conftest.py'.
tests/conftest.py:4: in <module>
    from curio import Kernel
curio/__init__.py:6: in <module>
    from .queue import *
curio/queue.py:20: in <module>
    from . import workers
curio/workers.py:23: in <module>
    from .channel import Connection
curio/channel.py:31: in <module>
    CHALLENGE = mpc.CHALLENGE                   # b'#CHALLENGE#'
E   AttributeError: module 'multiprocessing.connection' has no attribute 'CHALLENGE'. Did you mean: '_CHALLENGE'?

CHALLENGE, WELCOME, and FAILURE were renamed to prefix them with an underscore. I realize this is likely an indication that the constants are private and should not be used, but importing the new private names does resolve the exception.

removed ssl.wrap_socket

ImportError while loading conftest '/home/carl/development/curio/tests/conftest.py'.
tests/conftest.py:4: in <module>
    from curio import Kernel
curio/__init__.py:12: in <module>
    from .network import *
curio/network.py:18: in <module>
    from . import ssl as curiossl
curio/ssl.py:30: in <module>
    @wraps(_ssl.wrap_socket)
E   AttributeError: module 'ssl' has no attribute 'wrap_socket'

ssl.wrap_socket has been deprecated since Python 3.7, and is removed outright in 3.12. The upstream notice recommends ssl.SSLContext.wrap_socket instead. Making that adjustment resolves the exception.

hugovk commented 10 months ago

Please see PR https://github.com/dabeaz/curio/pull/363 to apply these suggestions.