Support the deprecation of asyncore in python 3.12 by fruch · Pull Request #260 · scylladb/python-driver · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-experimental.yml
2 changes: 1 addition & 1 deletion .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:
CIBW_BEFORE_TEST: "pip install -r {project}/test-requirements.txt"
CIBW_BEFORE_BUILD_LINUX: "rm -rf ~/.pyxbld && yum install -y libffi-devel libev libev-devel openssl openssl-devel"
CIBW_ENVIRONMENT: "CASS_DRIVER_BUILD_CONCURRENCY=2 CFLAGS='-g0 -O3'"
CIBW_SKIP: cp35* cp36* *musllinux* cp312*
CIBW_SKIP: cp35* cp36* *musllinux*
Comment thread
Lorak-mmk marked this conversation as resolved.

jobs:
build_wheels:
Expand Down
19 changes: 14 additions & 5 deletions cassandra/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@

try:
from cassandra.io.eventletreactor import EventletConnection
except ImportError:
except (ImportError, AttributeError):
# AttributeError was add for handling python 3.12 https://github.com/eventlet/eventlet/issues/812
# TODO: remove it when eventlet issue would be fixed
EventletConnection = None

try:
Expand All @@ -115,9 +117,13 @@
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')
except (ImportError, AttributeError):
# AttributeError was add for handling python 3.12 https://github.com/eventlet/eventlet/issues/812
# TODO: remove it when eventlet issue would be fixed
return False

def _is_gevent_monkey_patched():
if 'gevent.monkey' not in sys.modules:
Expand All @@ -137,7 +143,10 @@ def _is_gevent_monkey_patched():
try:
from cassandra.io.libevreactor import LibevConnection as DefaultConnection # NOQA
except ImportError:
from cassandra.io.asyncorereactor import AsyncoreConnection as DefaultConnection # NOQA
try:
from cassandra.io.asyncorereactor import AsyncoreConnection as DefaultConnection # NOQA
except ImportError:
from cassandra.io.asyncioreactor import AsyncioConnection as DefaultConnection # NOQA

# Forces load of utf8 encoding module to avoid deadlock that occurs
# if code that is being imported tries to import the module in a seperate
Expand Down
1 change: 0 additions & 1 deletion tests/integration/standard/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import asyncore
import subprocess

import unittest
Expand Down
8 changes: 6 additions & 2 deletions tests/integration/standard/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@

from cassandra import ConsistencyLevel, OperationTimedOut
from cassandra.cluster import NoHostAvailable, ConnectionShutdown, ExecutionProfile, EXEC_PROFILE_DEFAULT
import cassandra.io.asyncorereactor
from cassandra.io.asyncorereactor import AsyncoreConnection

try:
from cassandra.io.asyncorereactor import AsyncoreConnection
except ImportError:
AsyncoreConnection = None

from cassandra.protocol import QueryMessage
from cassandra.connection import Connection
from cassandra.policies import HostFilterPolicy, RoundRobinPolicy, HostStateListener
Expand Down
19 changes: 13 additions & 6 deletions tests/integration/standard/test_scylla_cloud.py