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

Fix the way to mangle temporary local variables used by serializers #204

Merged
merged 1 commit into from Dec 21, 2017

Conversation

Projects
None yet
2 participants
@dahlia
Member

dahlia commented Dec 21, 2017

Generated serializers had to generated temporary local variables and referred to it, but sometimes these had had an invalid name (e.g., __self.field_name__elem__). This patch fixes the bug besides the following bugs:

  • A bug that map types had been serialized in JSON to {k: v} while these should be [{"key": k, "value": v}].

  • A potential bug that temporary variables had been leaked to their outer scope in Python 2 since local variables in list comprehensions aren't isolated in Python 2. See also What's New in Python 3.0:

    Also note that list comprehensions have different semantics: they are closer to syntactic sugar for a generator expression inside a list() constructor, and in particular the loop control variables are no longer leaked into the surrounding scope.

@dahlia dahlia self-assigned this Dec 21, 2017

@dahlia dahlia requested review from kanghyojun and Kroisse Dec 21, 2017

@dahlia dahlia force-pushed the dahlia:fix-temp-var-mangling branch from 3cd8d36 to a294f5b Dec 21, 2017

@dahlia dahlia merged commit ac99efd into nirum-lang:master Dec 21, 2017

1 check was pending

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment