PYTHON-5555 Fix AWS Lambda build (#2540)

This commit is contained in:
Steven Silvester 2025-09-17 06:39:37 -05:00 committed by GitHub
parent 5787acc271
commit a7a645f85f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 10 deletions

View File

@ -107,7 +107,7 @@ class _SrvResolver:
# No TXT records
return None
except Exception as exc:
raise ConfigurationError(str(exc)) from None
raise ConfigurationError(str(exc)) from exc
if len(results) > 1:
raise ConfigurationError("Only one TXT record is supported")
return (b"&".join([b"".join(res.strings) for res in results])).decode("utf-8") # type: ignore[attr-defined]
@ -122,7 +122,7 @@ class _SrvResolver:
# Raise the original error.
raise
# Else, raise all errors as ConfigurationError.
raise ConfigurationError(str(exc)) from None
raise ConfigurationError(str(exc)) from exc
return results
async def _get_srv_response_and_hosts(
@ -145,8 +145,8 @@ class _SrvResolver:
)
try:
nlist = srv_host.split(".")[1:][-self.__slen :]
except Exception:
raise ConfigurationError(f"Invalid SRV host: {node[0]}") from None
except Exception as exc:
raise ConfigurationError(f"Invalid SRV host: {node[0]}") from exc
if self.__plist != nlist:
raise ConfigurationError(f"Invalid SRV host: {node[0]}")
if self.__srv_max_hosts:

View File

@ -107,7 +107,7 @@ class _SrvResolver:
# No TXT records
return None
except Exception as exc:
raise ConfigurationError(str(exc)) from None
raise ConfigurationError(str(exc)) from exc
if len(results) > 1:
raise ConfigurationError("Only one TXT record is supported")
return (b"&".join([b"".join(res.strings) for res in results])).decode("utf-8") # type: ignore[attr-defined]
@ -122,7 +122,7 @@ class _SrvResolver:
# Raise the original error.
raise
# Else, raise all errors as ConfigurationError.
raise ConfigurationError(str(exc)) from None
raise ConfigurationError(str(exc)) from exc
return results
def _get_srv_response_and_hosts(
@ -145,8 +145,8 @@ class _SrvResolver:
)
try:
nlist = srv_host.split(".")[1:][-self.__slen :]
except Exception:
raise ConfigurationError(f"Invalid SRV host: {node[0]}") from None
except Exception as exc:
raise ConfigurationError(f"Invalid SRV host: {node[0]}") from exc
if self.__plist != nlist:
raise ConfigurationError(f"Invalid SRV host: {node[0]}")
if self.__srv_max_hosts:

View File

@ -1,5 +1,5 @@
#!/bin/bash -ex
cd /src
PYTHON=/opt/python/cp39-cp39/bin/python
PYTHON=/opt/python/cp310-cp310/bin/python
$PYTHON -m pip install -v -e .

View File

@ -23,7 +23,7 @@ Resources:
Variables:
MONGODB_URI: !Ref MongoDbUri
Handler: app.lambda_handler
Runtime: python3.9
Runtime: python3.10
Architectures:
- x86_64
Events: