Author: Carl Friedrich Bolz <cfb...@gmx.de> Branch: Changeset: r83899:4f5be790880a Date: 2016-04-26 11:51 +0300 http://bitbucket.org/pypy/pypy/changeset/4f5be790880a/
Log: merge heads diff --git a/lib-python/stdlib-upgrade.txt b/lib-python/stdlib-upgrade.txt --- a/lib-python/stdlib-upgrade.txt +++ b/lib-python/stdlib-upgrade.txt @@ -5,15 +5,23 @@ overly detailed -1. check out the branch vendor/stdlib +0. make sure your working dir is clean +1. check out the branch vendor/stdlib (for 2.7) or vendor/stdlib-3-* (for py3k) + or create branch vendor/stdlib-3-* 2. upgrade the files there + 2a. remove lib-python/2.7/ or lib-python/3/ + 2b. copy the files from the cpython repo + 2c. hg add lib-python/2.7/ or lib-python/3/ + 2d. hg remove --after + 2e. show copied files in cpython repo by running `hg diff --git -r v<old> -r v<new> Lib | grep '^copy \(from\|to\)'` + 2f. fix copies / renames manually by running `hg copy --after <from> <to>` for each copied file 3. update stdlib-version.txt with the output of hg -id from the cpython repo 4. commit -5. update to default/py3k +5. update to default / py3k 6. create a integration branch for the new stdlib (just hg branch stdlib-$version) -7. merge vendor/stdlib +7. merge vendor/stdlib or vendor/stdlib-3-* 8. commit 10. fix issues 11. commit --close-branch -12. merge to default +12. merge to default / py3k diff --git a/pypy/interpreter/executioncontext.py b/pypy/interpreter/executioncontext.py --- a/pypy/interpreter/executioncontext.py +++ b/pypy/interpreter/executioncontext.py @@ -214,6 +214,7 @@ self._trace(frame, 'exception', None, operationerr) #operationerr.print_detailed_traceback(self.space) + @jit.dont_look_inside @specialize.arg(1) def sys_exc_info(self, for_hidden=False): """Implements sys.exc_info(). @@ -225,15 +226,7 @@ # NOTE: the result is not the wrapped sys.exc_info() !!! """ - frame = self.gettopframe() - while frame: - if frame.last_exception is not None: - if ((for_hidden or not frame.hide()) or - frame.last_exception is - get_cleared_operation_error(self.space)): - return frame.last_exception - frame = frame.f_backref() - return None + return self.gettopframe()._exc_info_unroll(self.space, for_hidden) def set_sys_exc_info(self, operror): frame = self.gettopframe_nohidden() diff --git a/pypy/interpreter/pyframe.py b/pypy/interpreter/pyframe.py --- a/pypy/interpreter/pyframe.py +++ b/pypy/interpreter/pyframe.py @@ -4,7 +4,7 @@ from rpython.rlib import jit from rpython.rlib.debug import make_sure_not_resized, check_nonneg from rpython.rlib.jit import hint -from rpython.rlib.objectmodel import we_are_translated, instantiate +from rpython.rlib.objectmodel import instantiate, specialize, we_are_translated from rpython.rlib.rarithmetic import intmask, r_uint from rpython.tool.pairtype import extendabletype @@ -12,7 +12,8 @@ from pypy.interpreter.argument import Arguments from pypy.interpreter.astcompiler import consts from pypy.interpreter.baseobjspace import W_Root -from pypy.interpreter.error import OperationError, oefmt +from pypy.interpreter.error import ( + OperationError, get_cleared_operation_error, oefmt) from pypy.interpreter.executioncontext import ExecutionContext from pypy.interpreter.nestedscope import Cell from pypy.tool import stdlib_opcode @@ -870,6 +871,22 @@ return space.wrap(self.builtin is not space.builtin) return space.w_False + @jit.unroll_safe + @specialize.arg(2) + def _exc_info_unroll(self, space, for_hidden=False): + """Return the most recent OperationError being handled in the + call stack + """ + frame = self + while frame: + last = frame.last_exception + if last is not None: + if last is get_cleared_operation_error(self.space): + break + if for_hidden or not frame.hide(): + return last + frame = frame.f_backref() + return None # ____________________________________________________________ diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py --- a/pypy/interpreter/pyopcode.py +++ b/pypy/interpreter/pyopcode.py @@ -739,25 +739,16 @@ unroller = SContinueLoop(startofloop) return self.unrollstack_and_jump(unroller) - @jit.unroll_safe def RAISE_VARARGS(self, nbargs, next_instr): space = self.space if nbargs == 0: - frame = self - while frame: - if frame.last_exception is not None: - operror = frame.last_exception - break - frame = frame.f_backref() - else: - raise OperationError(space.w_TypeError, - space.wrap("raise: no active exception to re-raise")) - if operror.w_type is space.w_None: - raise OperationError(space.w_TypeError, - space.wrap("raise: the exception to re-raise was cleared")) + last_operr = self._exc_info_unroll(space) + if last_operr is None: + raise oefmt(space.w_TypeError, + "No active exception to reraise") # re-raise, no new traceback obj will be attached - self.last_exception = operror - raise RaiseWithExplicitTraceback(operror) + self.last_exception = last_operr + raise RaiseWithExplicitTraceback(last_operr) w_value = w_traceback = space.w_None if nbargs >= 3: _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit