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):
941941 try :
942942 yield
943943 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
947955
948956 @contextmanager
949957 def fork (
Original file line number Diff line number Diff line change @@ -943,9 +943,17 @@ async def fail_point(self, command_args):
943943 try :
944944 yield
945945 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
949957
950958 @contextmanager
951959 def fork (
You can’t perform that action at this time.
0 commit comments