parent
b5fd3cfb84
commit
ca44e88e54
|
@ -1,3 +1,9 @@
|
||||||
|
2.7.2 (compared to 2.7.1)
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
- fix issue735: assertion failures on debug versions of Python 3.4+
|
||||||
|
Thanks Benjamin Peterson.
|
||||||
|
|
||||||
2.7.1 (compared to 2.7.0)
|
2.7.1 (compared to 2.7.0)
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
|
|
|
@ -442,6 +442,13 @@ binop_map = {
|
||||||
ast.NotIn: "not in"
|
ast.NotIn: "not in"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Python 3.4+ compatibility
|
||||||
|
if hasattr(ast, "NameConstant"):
|
||||||
|
_NameConstant = ast.NameConstant
|
||||||
|
else:
|
||||||
|
def _NameConstant(c):
|
||||||
|
return ast.Name(str(c), ast.Load())
|
||||||
|
|
||||||
|
|
||||||
def set_location(node, lineno, col_offset):
|
def set_location(node, lineno, col_offset):
|
||||||
"""Set node location information recursively."""
|
"""Set node location information recursively."""
|
||||||
|
@ -680,7 +687,7 @@ class AssertionRewriter(ast.NodeVisitor):
|
||||||
if self.variables:
|
if self.variables:
|
||||||
variables = [ast.Name(name, ast.Store())
|
variables = [ast.Name(name, ast.Store())
|
||||||
for name in self.variables]
|
for name in self.variables]
|
||||||
clear = ast.Assign(variables, ast.Name("None", ast.Load()))
|
clear = ast.Assign(variables, _NameConstant(None))
|
||||||
self.statements.append(clear)
|
self.statements.append(clear)
|
||||||
# Fix line numbers.
|
# Fix line numbers.
|
||||||
for stmt in self.statements:
|
for stmt in self.statements:
|
||||||
|
|
Loading…
Reference in New Issue