[pypy-commit] pypy py3.6: remove windows ^M line endings
mattip
pypy.commits at gmail.com
Wed Sep 25 11:06:20 EDT 2019
Author: Matti Picus <matti.picus at gmail.com>
Branch: py3.6
Changeset: r97605:388678c00faf
Date: 2019-09-25 18:02 +0300
http://bitbucket.org/pypy/pypy/changeset/388678c00faf/
Log: remove windows ^M line endings
diff --git a/pypy/interpreter/pyframe.py b/pypy/interpreter/pyframe.py
--- a/pypy/interpreter/pyframe.py
+++ b/pypy/interpreter/pyframe.py
@@ -668,15 +668,15 @@
except OperationError:
raise oefmt(space.w_ValueError, "lineno must be an integer")
- # You can only do this from within a trace function, not via
- # _getframe or similar hackery.
+ # You can only do this from within a trace function, not via
+ # _getframe or similar hackery.
if self.get_w_f_trace() is None:
raise oefmt(space.w_ValueError,
- "f_lineno can only be set by a trace function.")
+ "f_lineno can only be set by a trace function")
- # Only allow jumps when we're tracing a line event.
- d = self.getorcreatedebug()
- if not d.is_in_line_tracing:
+ # Only allow jumps when we're tracing a line event.
+ d = self.getorcreatedebug()
+ if not d.is_in_line_tracing:
raise oefmt(space.w_ValueError,
"can only jump from a 'line' trace event")
@@ -687,7 +687,7 @@
elif new_lineno == line:
new_lasti = 0
else:
- # Find the bytecode offset for the start of the given
+ # Find the bytecode offset for the start of the given
# line, or the first code-owning line after it.
lnotab = self.pycode.co_lnotab
addr = 0
@@ -708,33 +708,33 @@
raise oefmt(space.w_ValueError,
"line %d comes after the current code block", new_lineno)
- min_addr = min(new_lasti, self.last_instr)
+ min_addr = min(new_lasti, self.last_instr)
max_addr = max(new_lasti, self.last_instr)
- # You can't jump onto a line with an 'except' statement on it -
- # they expect to have an exception on the top of the stack, which
- # won't be true if you jump to them. They always start with code
- # that either pops the exception using POP_TOP (plain 'except:'
- # lines do this) or duplicates the exception on the stack using
- # DUP_TOP (if there's an exception type specified). See compile.c,
- # 'com_try_except' for the full details. There aren't any other
- # cases (AFAIK) where a line's code can start with DUP_TOP or
- # POP_TOP, but if any ever appear, they'll be subject to the same
- # restriction (but with a different error message).
+ # You can't jump onto a line with an 'except' statement on it -
+ # they expect to have an exception on the top of the stack, which
+ # won't be true if you jump to them. They always start with code
+ # that either pops the exception using POP_TOP (plain 'except:'
+ # lines do this) or duplicates the exception on the stack using
+ # DUP_TOP (if there's an exception type specified). See compile.c,
+ # 'com_try_except' for the full details. There aren't any other
+ # cases (AFAIK) where a line's code can start with DUP_TOP or
+ # POP_TOP, but if any ever appear, they'll be subject to the same
+ # restriction (but with a different error message).
code = self.pycode.co_code
if ord(code[new_lasti]) in (DUP_TOP, POP_TOP):
raise oefmt(space.w_ValueError,
"can't jump to 'except' line as there's no exception")
- # You can't jump into or out of a 'finally' block because the 'try'
- # block leaves something on the stack for the END_FINALLY to clean
- # up. So we walk the bytecode, maintaining a simulated blockstack.
- # When we reach the old or new address and it's in a 'finally' block
- # we note the address of the corresponding SETUP_FINALLY. The jump
- # is only legal if neither address is in a 'finally' block or
- # they're both in the same one. 'blockstack' is a stack of the
- # bytecode addresses of the SETUP_X opcodes, and 'in_finally' tracks
- # whether we're in a 'finally' block at each blockstack level.
+ # You can't jump into or out of a 'finally' block because the 'try'
+ # block leaves something on the stack for the END_FINALLY to clean
+ # up. So we walk the bytecode, maintaining a simulated blockstack.
+ # When we reach the old or new address and it's in a 'finally' block
+ # we note the address of the corresponding SETUP_FINALLY. The jump
+ # is only legal if neither address is in a 'finally' block or
+ # they're both in the same one. 'blockstack' is a stack of the
+ # bytecode addresses of the SETUP_X opcodes, and 'in_finally' tracks
+ # whether we're in a 'finally' block at each blockstack level.
# PYPY NOTE: CPython (at least 3.5.2+) doesn't check except blocks,
# but that results in crashes. But for now I'm going to follow the
@@ -762,17 +762,17 @@
else:
del blockstack[-1]
elif op == END_FINALLY:
- # Ignore END_FINALLYs for SETUP_EXCEPTs - they exist
- # in the bytecode but don't correspond to an actual
- # 'finally' block. (If len(blockstack) is 0, we must
- # be seeing such an END_FINALLY.)
+ # Ignore END_FINALLYs for SETUP_EXCEPTs - they exist
+ # in the bytecode but don't correspond to an actual
+ # 'finally' block. (If len(blockstack) is 0, we must
+ # be seeing such an END_FINALLY.)
if len(blockstack) > 0:
- setup_op = ord(code[blockstack[-1]])
- if setup_op in (SETUP_FINALLY, SETUP_WITH, SETUP_ASYNC_WITH):
- del blockstack[-1]
+ setup_op = ord(code[blockstack[-1]])
+ if setup_op in (SETUP_FINALLY, SETUP_WITH, SETUP_ASYNC_WITH):
+ del blockstack[-1]
- # For the addresses we're interested in, see whether they're
- # within a 'finally' block and if so, remember the address
+ # For the addresses we're interested in, see whether they're
+ # within a 'finally' block and if so, remember the address
# of the SETUP_FINALLY.
if addr == new_lasti or addr == self.last_instr:
setup_addr = -1
@@ -781,11 +781,11 @@
setup_addr = blockstack[i]
break
- if setup_addr != -1:
- if addr == new_lasti:
- new_lasti_setup_addr = setup_addr
- if addr == self.last_instr:
- f_lasti_setup_addr = setup_addr
+ if setup_addr != -1:
+ if addr == new_lasti:
+ new_lasti_setup_addr = setup_addr
+ if addr == self.last_instr:
+ f_lasti_setup_addr = setup_addr
addr += 2
# Verify that the blockstack tracking code didn't get lost.
@@ -804,14 +804,14 @@
# needs a SysExcInfoRestorer. Check that we're not jumping
# *into* a block, but only (potentially) out of some blocks.
- # Police block-jumping (you can't jump into the middle of a block)
- # and ensure that the blockstack finishes up in a sensible state (by
- # popping any blocks we're jumping out of). We look at all the
- # blockstack operations between the current position and the new
- # one, and keep track of how many blocks we drop out of on the way.
- # By also keeping track of the lowest blockstack position we see, we
- # can tell whether the jump goes into any blocks without coming out
- # again - in that case we raise an exception below.
+ # Police block-jumping (you can't jump into the middle of a block)
+ # and ensure that the blockstack finishes up in a sensible state (by
+ # popping any blocks we're jumping out of). We look at all the
+ # blockstack operations between the current position and the new
+ # one, and keep track of how many blocks we drop out of on the way.
+ # By also keeping track of the lowest blockstack position we see, we
+ # can tell whether the jump goes into any blocks without coming out
+ # again - in that case we raise an exception below.
delta_iblock = min_delta_iblock = 0
addr = min_addr
More information about the pypy-commit
mailing list