diff --git a/CHANGELOG.md b/CHANGELOG.md index adf52b5f..272f4174 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 7.5.1 - 2026-01-07 + +fix: avoid return from finally block to fix Python 3.14 SyntaxWarning (#361)[https://github.com/PostHog/posthog-python/pull/361] - thanks @jodal + # 7.5.0 - 2026-01-06 feat: Capture Langchain, OpenAI and Anthropic errors as exceptions (if exception autocapture is enabled) diff --git a/posthog/consumer.py b/posthog/consumer.py index cbb77fd1..021d4343 100644 --- a/posthog/consumer.py +++ b/posthog/consumer.py @@ -84,12 +84,16 @@ def upload(self): self.log.error("error uploading: %s", e) success = False if self.on_error: - self.on_error(e, batch) + try: + self.on_error(e, batch) + except Exception as e: + self.log.error("on_error handler failed: %s", e) finally: # mark items as acknowledged from queue for item in batch: self.queue.task_done() - return success + + return success def next(self): """Return the next batch of items to upload.""" diff --git a/posthog/version.py b/posthog/version.py index 337cf760..353acdce 100644 --- a/posthog/version.py +++ b/posthog/version.py @@ -1,4 +1,4 @@ -VERSION = "7.5.0" +VERSION = "7.5.1" if __name__ == "__main__": print(VERSION, end="") # noqa: T201