Skip to content

Commit

Permalink
PYTHON-1364 Fix ssl.wrap_socket errors (from eventlet) for Python 3.12 (
Browse files Browse the repository at this point in the history
  • Loading branch information
absurdfarce authored Oct 12, 2023
1 parent 375da00 commit a7ab8cc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions cassandra/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@

try:
from cassandra.io.eventletreactor import EventletConnection
except ImportError:
# PYTHON-1364
#
# At the moment eventlet initialization is chucking AttributeErrors due to it's dependence on pyOpenSSL
# and some changes in Python 3.12 which have some knock-on effects there.
except (ImportError, AttributeError):
EventletConnection = None

try:
Expand All @@ -113,8 +117,12 @@
def _is_eventlet_monkey_patched():
if 'eventlet.patcher' not in sys.modules:
return False
import eventlet.patcher
return eventlet.patcher.is_monkey_patched('socket')
try:
import eventlet.patcher
return eventlet.patcher.is_monkey_patched('socket')
# Another case related to PYTHON-1364
except AttributeError:
return False


def _is_gevent_monkey_patched():
Expand Down

0 comments on commit a7ab8cc

Please sign in to comment.