Commit 457c0ee4 authored by Stefan Behnel's avatar Stefan Behnel

fix compiler crash when manager.__enter__() call node in with statement gets replaced

parent 135dc33c
......@@ -11312,11 +11312,14 @@ class ProxyNode(CoercionNode):
self.constant_result = arg.constant_result
self._proxy_type()
def analyse_expressions(self, env):
def analyse_types(self, env):
self.arg = self.arg.analyse_expressions(env)
self._proxy_type()
return self
def infer_type(self, env):
return self.arg.infer_type(env)
def _proxy_type(self):
if hasattr(self.arg, 'type'):
self.type = self.arg.type
......
......@@ -1220,13 +1220,13 @@ class WithTransform(CythonTransform, SkipDeclarations):
self.visitchildren(node, 'body')
pos = node.pos
body, target, manager = node.body, node.target, node.manager
node.enter_call = ExprNodes.SimpleCallNode(
node.enter_call = ExprNodes.ProxyNode(ExprNodes.SimpleCallNode(
pos, function=ExprNodes.AttributeNode(
pos, obj=ExprNodes.CloneNode(manager),
attribute=EncodedString('__enter__'),
is_special_lookup=True),
args=[],
is_temp=True)
is_temp=True))
if target is not None:
body = Nodes.StatListNode(
pos, stats = [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment