Skip to content

Control unicode encoding behaviour based on execution environment. #122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 27, 2023

Conversation

briensea
Copy link
Contributor

Issue #, if available:
N/A

Description of changes:
Control unicode encoding behaviour based on execution environment.

Target (OCI, Managed Runtime, both):
Both.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@alex-pewpew
Copy link
Contributor

Recommendation is to not implement the features gating abstraction for now to unblock safe version bump, and polish this PR

@@ -15,7 +15,10 @@
# We also set 'ensure_ascii=False' so that the encoded json contains unicode characters instead of unicode escape sequences
class Encoder(json.JSONEncoder):
def __init__(self):
super().__init__(use_decimal=False, ensure_ascii=False)
if os.environ.get("AWS_EXECUTION_ENV") in {"AWS_Lambda_python3.12"}:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicks:

if os.environ.get("AWS_EXECUTION_ENV") == "AWS_Lambda_python3.12":

to avoid extra set object creation

@alex-pewpew
Copy link
Contributor

LGTM, thank you!

@briensea briensea merged commit 80eefef into aws:main Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants