Skip to content

Commit 9e64ed1

Browse files
authored
PYTHON-4755 - Stop supporting and testing against Eventlet (#2557)
1 parent 0049dc8 commit 9e64ed1

File tree

14 files changed

+17
-63
lines changed

14 files changed

+17
-63
lines changed

.evergreen/generated_configs/variants.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -319,14 +319,6 @@ buildvariants:
319319
tags: []
320320

321321
# Green framework tests
322-
- name: green-eventlet-rhel8
323-
tasks:
324-
- name: .test-standard .python-3.9 .sync
325-
display_name: Green Eventlet RHEL8
326-
run_on:
327-
- rhel87-small
328-
expansions:
329-
GREEN_FRAMEWORK: eventlet
330322
- name: green-gevent-rhel8
331323
tasks:
332324
- name: .test-standard .sync

.evergreen/scripts/generate_config.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,8 @@ def create_stable_api_variants():
300300
def create_green_framework_variants():
301301
variants = []
302302
host = DEFAULT_HOST
303-
for framework in ["eventlet", "gevent"]:
303+
for framework in ["gevent"]:
304304
tasks = [".test-standard .sync"]
305-
if framework == "eventlet":
306-
# Eventlet has issues with dnspython > 2.0 and newer versions of CPython
307-
# https://jira.mongodb.org/browse/PYTHON-5284
308-
tasks = [".test-standard .python-3.9 .sync"]
309305
expansions = dict(GREEN_FRAMEWORK=framework)
310306
display_name = get_variant_name(f"Green {framework.capitalize()}", host)
311307
variant = create_variant(tasks, display_name, host=host, expansions=expansions)

.evergreen/scripts/run_tests.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,7 @@ def handle_perf(start_time: datetime):
6767

6868

6969
def handle_green_framework() -> None:
70-
if GREEN_FRAMEWORK == "eventlet":
71-
import eventlet
72-
73-
# https://github.com/eventlet/eventlet/issues/401
74-
eventlet.sleep()
75-
eventlet.monkey_patch()
76-
elif GREEN_FRAMEWORK == "gevent":
70+
if GREEN_FRAMEWORK == "gevent":
7771
from gevent import monkey
7872

7973
monkey.patch_all()

.evergreen/scripts/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def get_test_options(
104104
parser.add_argument(
105105
"--green-framework",
106106
nargs=1,
107-
choices=["eventlet", "gevent"],
107+
choices=["gevent"],
108108
help="Optional green framework to test against.",
109109
)
110110
parser.add_argument(

doc/changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ PyMongo 4.16 brings a number of changes including:
99
- Removed invalid documents from :class:`bson.errors.InvalidDocument` error messages as
1010
doing so may leak sensitive user data.
1111
Instead, invalid documents are stored in :attr:`bson.errors.InvalidDocument.document`.
12+
- Removed support for Eventlet.
13+
Eventlet is actively being sunset by its maintainers and has compatibility issues with PyMongo's dnspython dependency.
1214

1315
Changes in Version 4.15.1 (2025/09/16)
1416
--------------------------------------

pymongo/asynchronous/pool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ async def _raise_connection_failure(self, error: BaseException) -> NoReturn:
628628
# signals and throws KeyboardInterrupt into the current frame on the
629629
# main thread.
630630
#
631-
# But in Gevent and Eventlet, the polling mechanism (epoll, kqueue,
631+
# But in Gevent, the polling mechanism (epoll, kqueue,
632632
# ..) is called in Python code, which experiences the signal as a
633633
# KeyboardInterrupt from the start, rather than as an initial
634634
# socket.error, so we catch that, close the socket, and reraise it.

pymongo/pool_shared.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,11 @@ def _raise_connection_failure(
138138
msg = msg_prefix + msg
139139
if "configured timeouts" not in msg:
140140
msg += format_timeout_details(timeout_details)
141-
if isinstance(error, socket.timeout):
142-
raise NetworkTimeout(msg) from error
143-
elif isinstance(error, SSLErrors) and "timed out" in str(error):
144-
# Eventlet does not distinguish TLS network timeouts from other
145-
# SSLErrors (https://github.com/eventlet/eventlet/issues/692).
146-
# Luckily, we can work around this limitation because the phrase
147-
# 'timed out' appears in all the timeout related SSLErrors raised.
141+
if (
142+
isinstance(error, socket.timeout)
143+
or isinstance(error, SSLErrors)
144+
and "timed out" in str(error)
145+
):
148146
raise NetworkTimeout(msg) from error
149147
else:
150148
raise AutoReconnect(msg) from error

pymongo/synchronous/pool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ def _raise_connection_failure(self, error: BaseException) -> NoReturn:
626626
# signals and throws KeyboardInterrupt into the current frame on the
627627
# main thread.
628628
#
629-
# But in Gevent and Eventlet, the polling mechanism (epoll, kqueue,
629+
# But in Gevent, the polling mechanism (epoll, kqueue,
630630
# ..) is called in Python code, which experiences the signal as a
631631
# KeyboardInterrupt from the start, rather than as an initial
632632
# socket.error, so we catch that, close the socket, and reraise it.

pyproject.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ dev = [
5252
pip = ["pip"]
5353
# TODO: PYTHON-5464
5454
gevent = ["gevent", "cffi>=2.0.0b1;python_version=='3.14'"]
55-
eventlet = ["eventlet"]
5655
coverage = [
5756
"pytest-cov",
5857
"coverage>=5,<=7.10.6"
@@ -113,15 +112,12 @@ filterwarnings = [
113112
"module:.*WindowsSelectorEventLoopPolicy:DeprecationWarning",
114113
"module:.*et_event_loop_policy:DeprecationWarning",
115114
# TODO: Remove as part of PYTHON-3923.
116-
"module:unclosed <eventlet.green.ssl.GreenSSLSocket:ResourceWarning",
117115
"module:unclosed <socket.socket:ResourceWarning",
118116
"module:unclosed <ssl.SSLSocket:ResourceWarning",
119117
"module:unclosed <socket object:ResourceWarning",
120118
"module:unclosed transport:ResourceWarning",
121119
# pytest-asyncio known issue: https://github.com/pytest-dev/pytest-asyncio/issues/724
122120
"module:unclosed event loop:ResourceWarning",
123-
# https://github.com/eventlet/eventlet/issues/818
124-
"module:please use dns.resolver.Resolver.resolve:DeprecationWarning",
125121
# https://github.com/dateutil/dateutil/issues/1314
126122
"module:datetime.datetime.utc:DeprecationWarning",
127123
]

test/asynchronous/test_encryption.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ async def test_use_after_close(self):
399399
)
400400
@unittest.skipIf(
401401
is_greenthread_patched(),
402-
"gevent and eventlet do not support POSIX-style forking.",
402+
"gevent does not support POSIX-style forking.",
403403
)
404404
@async_client_context.require_sync
405405
async def test_fork(self):

0 commit comments

Comments
 (0)