Skip to content

Commit 12aa997

Browse files
hmilkovisethmlarson
authored andcommitted
[7.x] Reraise RecursionError in Transport.perform_request()
1 parent 1787f64 commit 12aa997

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

elasticsearch/_async/http_aiohttp.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,9 @@ async def perform_request(
303303
raw_data = await response.text()
304304
duration = self.loop.time() - start
305305

306-
# We want to reraise a cancellation.
307-
except asyncio.CancelledError:
306+
# We want to reraise a cancellation or recursion error.
307+
except (asyncio.CancelledError, RecursionError):
308308
raise
309-
310309
except Exception as e:
311310
self.log_request_fail(
312311
method,

elasticsearch/connection/http_requests.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ def perform_request(
166166
response = self.session.send(prepared_request, **send_kwargs)
167167
duration = time.time() - start
168168
raw_data = response.content.decode("utf-8", "surrogatepass")
169+
except RecursionError:
170+
raise
169171
except Exception as e:
170172
self.log_request_fail(
171173
method,

elasticsearch/connection/http_urllib3.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ def perform_request(
253253
)
254254
duration = time.time() - start
255255
raw_data = response.data.decode("utf-8", "surrogatepass")
256+
except RecursionError:
257+
raise
256258
except Exception as e:
257259
self.log_request_fail(
258260
method, full_url, url, orig_body, time.time() - start, exception=e

0 commit comments

Comments
 (0)