Skip to content

Commit

Permalink
[7.13] Reraise RecursionError in Transport.perform_request()
Browse files Browse the repository at this point in the history
  • Loading branch information
hmilkovi authored and sethmlarson committed Jun 7, 2021
1 parent d2d81db commit 448397a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 2 additions & 3 deletions elasticsearch/_async/http_aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,9 @@ async def perform_request(
raw_data = await response.text()
duration = self.loop.time() - start

# We want to reraise a cancellation.
except asyncio.CancelledError:
# We want to reraise a cancellation or recursion error.
except (asyncio.CancelledError, RecursionError):
raise

except Exception as e:
self.log_request_fail(
method,
Expand Down
2 changes: 2 additions & 0 deletions elasticsearch/connection/http_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ def perform_request(
response = self.session.send(prepared_request, **send_kwargs)
duration = time.time() - start
raw_data = response.content.decode("utf-8", "surrogatepass")
except RecursionError:
raise
except Exception as e:
self.log_request_fail(
method,
Expand Down
2 changes: 2 additions & 0 deletions elasticsearch/connection/http_urllib3.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ def perform_request(
)
duration = time.time() - start
raw_data = response.data.decode("utf-8", "surrogatepass")
except RecursionError:
raise
except Exception as e:
self.log_request_fail(
method, full_url, url, orig_body, time.time() - start, exception=e
Expand Down

0 comments on commit 448397a

Please sign in to comment.