Author: Armin Rigo <[email protected]>
Branch: py3.5
Changeset: r90092:f922549d71f7
Date: 2017-02-13 17:06 +0100
http://bitbucket.org/pypy/pypy/changeset/f922549d71f7/
Log: simplify
diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -557,13 +557,13 @@
def raise_exc_unbound(self, varindex):
varname = self.getfreevarname(varindex)
if self.iscellvar(varindex):
- message = "local variable '%s' referenced before
assignment"%varname
- w_exc_type = self.space.w_UnboundLocalError
+ raise oefmt(self.space.w_UnboundLocalError,
+ "local variable '%s' referenced before assignment",
+ varname)
else:
- message = ("free variable '%s' referenced before assignment"
- " in enclosing scope"%varname)
- w_exc_type = self.space.w_NameError
- raise OperationError(w_exc_type, self.space.wrap(message))
+ raise oefmt(self.space.w_NameError,
+ "free variable '%s' referenced before assignment"
+ " in enclosing scope", varname)
def LOAD_CLOSURE(self, varindex, next_instr):
# nested scopes: access the cell object
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit