Code generation relies on positive id()
Bug #716954 reported by
Alan Hoey
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Chamelon Core |
New
|
Undecided
|
Unassigned |
Bug Description
When attempting to initially render a template I get a "can't assign to operator" syntax error. After the template has successfully rendered once it appears to work fine from then onwards.
Further investigation suggests that the problem is that there are multiple places in translation.py where variable names are generated using for example "_attrs_%d" % id(self.element)). If the result of id is negative, this creates an invalid name, which ultimately causes the error.
Chameleon-1.2.13
Python 2.4.6 (#2, Feb 11 2011, 10:33:37)
[GCC 4.4.3] on linux2
To post a comment you must log in.
I am seeing what appears to be the same issue when running Pyramid's test suite on PyPy 1.9.0 on Ubuntu.
Stack traces: https:/ /gist.github. com/2931176
The result of running the generated file (one_d1aff7bdf8 3cf7e7a25b2c56f dc91886eb87d7dc .py ) through Python:
marca@ ubuntu: ~/dev/git- repos/pyramid$ python one_d1aff7bdf83 cf7e7a25b2c56fd c91886eb87d7dc. py 3cf7e7a25b2c56f dc91886eb87d7dc .py", line 3
_static_ -1226789952 = {u'xmlns': u'http:// www.w3. org/1999/ xhtml', }
File "one_d1aff7bdf8
SyntaxError: can't assign to operator
and the contents of the file itself: https:/ /gist.github. com/2931197