Browse Source

Issue #28517: Fixed of-by-one error in the peephole optimizer that caused

keeping unreachable code.
pull/9921/head
Serhiy Storchaka 10 years ago
parent
commit
7db3c48833
  1. 3
      Misc/NEWS
  2. 2296
      Python/importlib.h
  3. 3915
      Python/importlib_external.h
  4. 4
      Python/peephole.c

3
Misc/NEWS

@ -10,6 +10,9 @@ What's New in Python 3.6.0 beta 3
Core and Builtins
-----------------
- Issue #28517: Fixed of-by-one error in the peephole optimizer that caused
keeping unreachable code.
- Issue #28214: Improved exception reporting for problematic __set_name__
attributes.

2296
Python/importlib.h
File diff suppressed because it is too large
View File

3915
Python/importlib_external.h
File diff suppressed because it is too large
View File

4
Python/peephole.c

@ -704,11 +704,11 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names,
/* Remove unreachable ops after RETURN */
case RETURN_VALUE:
h = i + 1;
while (h + 1 < codelen && ISBASICBLOCK(blocks, i, h + 1)) {
while (h < codelen && ISBASICBLOCK(blocks, i, h)) {
h++;
}
if (h > i + 1) {
fill_nops(codestr, i + 1, h + 1);
fill_nops(codestr, i + 1, h);
nexti = find_op(codestr, h);
}
break;

Loading…
Cancel
Save