File tree Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -941,9 +941,17 @@ def fail_point(self, command_args):
941
941
try :
942
942
yield
943
943
finally :
944
- client_context .client .admin .command (
945
- "configureFailPoint" , cmd_on ["configureFailPoint" ], mode = "off"
946
- )
944
+ try :
945
+ client_context .client .admin .command (
946
+ "configureFailPoint" , cmd_on ["configureFailPoint" ], mode = "off"
947
+ )
948
+ except pymongo .errors .ConnectionFailure :
949
+ # Workaround PyPy bug described in PYTHON-5011.
950
+ if not _IS_SYNC and "PyPy" in sys .version :
951
+ client_context .client .admin .command (
952
+ "configureFailPoint" , cmd_on ["configureFailPoint" ], mode = "off"
953
+ )
954
+ raise
947
955
948
956
@contextmanager
949
957
def fork (
Original file line number Diff line number Diff line change @@ -943,9 +943,17 @@ async def fail_point(self, command_args):
943
943
try :
944
944
yield
945
945
finally :
946
- await async_client_context .client .admin .command (
947
- "configureFailPoint" , cmd_on ["configureFailPoint" ], mode = "off"
948
- )
946
+ try :
947
+ await async_client_context .client .admin .command (
948
+ "configureFailPoint" , cmd_on ["configureFailPoint" ], mode = "off"
949
+ )
950
+ except pymongo .errors .ConnectionFailure :
951
+ # Workaround PyPy bug described in PYTHON-5011.
952
+ if not _IS_SYNC and "PyPy" in sys .version :
953
+ await async_client_context .client .admin .command (
954
+ "configureFailPoint" , cmd_on ["configureFailPoint" ], mode = "off"
955
+ )
956
+ raise
949
957
950
958
@contextmanager
951
959
def fork (
You can’t perform that action at this time.
0 commit comments