Commit 8df60525 authored by Vitja Makarov's avatar Vitja Makarov

Mark unblound local variable as "unlikely" case

parent a23b3c1a
...@@ -1559,7 +1559,7 @@ class NameNode(AtomicExprNode): ...@@ -1559,7 +1559,7 @@ class NameNode(AtomicExprNode):
elif entry.is_local: elif entry.is_local:
if entry.type.is_pyobject: if entry.type.is_pyobject:
if (self.cf_maybe_null or self.cf_is_null) and not self.allow_null: if (self.cf_maybe_null or self.cf_is_null) and not self.allow_null:
code.putln('if (%s == 0) { PyErr_SetString(PyExc_UnboundLocalError, "%s"); %s }' % code.putln('if (unlikely(!%s)) { PyErr_SetString(PyExc_UnboundLocalError, "%s"); %s }' %
(entry.cname, entry.name, code.error_goto(self.pos))) (entry.cname, entry.name, code.error_goto(self.pos)))
def generate_assignment_code(self, rhs, code): def generate_assignment_code(self, rhs, code):
...@@ -1693,7 +1693,7 @@ class NameNode(AtomicExprNode): ...@@ -1693,7 +1693,7 @@ class NameNode(AtomicExprNode):
elif self.entry.type.is_pyobject: elif self.entry.type.is_pyobject:
if not self.cf_is_null: if not self.cf_is_null:
if self.cf_maybe_null: if self.cf_maybe_null:
code.putln('if (%s == 0) { PyErr_SetString(PyExc_UnboundLocalError, "%s"); %s }' % code.putln('if (unlikely(!%s)) { PyErr_SetString(PyExc_UnboundLocalError, "%s"); %s }' %
(self.entry.cname, self.entry.name, code.error_goto(self.pos))) (self.entry.cname, self.entry.name, code.error_goto(self.pos)))
code.put_decref(self.result(), self.ctype()) code.put_decref(self.result(), self.ctype())
code.putln('%s = NULL;' % self.result()) code.putln('%s = NULL;' % self.result())
......
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