Skip to content
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 1 commit into from Dec 21, 2017


Copy link

@dahlia 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 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
1 check was pending
continuous-integration/travis-ci/pr The Travis CI build is in progress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants