File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
aws_lambda_powertools/logging Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 88import traceback
99from typing import (
1010 IO ,
11+ TYPE_CHECKING ,
1112 Any ,
1213 Callable ,
1314 Dict ,
@@ -241,10 +242,14 @@ def __init__(
241242
242243 self ._init_logger (formatter_options = formatter_options , ** kwargs )
243244
244- def __getattr__ (self , name ):
245- # Proxy attributes not found to actual logger to support backward compatibility
246- # https://github.com/awslabs/aws-lambda-powertools-python/issues/97
247- return getattr (self ._logger , name )
245+ # Prevent __getattr__ from shielding unknown attribute errors in type checkers
246+ # https://github.com/awslabs/aws-lambda-powertools-python/issues/1660
247+ if not TYPE_CHECKING :
248+
249+ def __getattr__ (self , name ):
250+ # Proxy attributes not found to actual logger to support backward compatibility
251+ # https://github.com/awslabs/aws-lambda-powertools-python/issues/97
252+ return getattr (self ._logger , name )
248253
249254 def _get_logger (self ):
250255 """Returns a Logger named {self.service}, or {self.service.filename} for child loggers"""
You can’t perform that action at this time.
0 commit comments