You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SyntaxWarning: 'return' in a 'finally' block (Python 3.14) #758
No warnings emitted during Lambda cold start when importing datadog_lambda.
Actual Behavior
A SyntaxWarning is emitted at module import time (cold start) on Python 3.14:
/var/task/datadog_lambda/wrapper.py:203: SyntaxWarning: 'return' in a 'finally' block
return self.blocking_response
This warning fires every cold start and pollutes CloudWatch logs. Python 3.14 introduced SyntaxWarning for return/break/continue inside finally blocks because such a return silently suppresses any exception that was actively propagating through the try/except.
Steps to Reproduce the Problem
Deploy a Lambda function using datadog-lambda on the Python 3.14 runtime
Trigger a cold start (first invocation or new sandbox)
Observe the SyntaxWarning in CloudWatch logs during INIT_START
Specifications
Datadog Lambda Library version: 8.123.0
Python version: 3.14
Root Cause
In _LambdaDecorator.__call__, the finally block contains a return:
Remove return self.response from the try block and return self.blocking_response from the finally block, deferring both to after the entire try/except/finally:
Activity