Skip to content
Prev Previous commit
Next Next commit
Clean up some comments
  • Loading branch information
brandtbucher committed Oct 28, 2021
commit 33f6e7c50a48b04810ed5bd57345652041dc102d
4 changes: 4 additions & 0 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -2004,6 +2004,10 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
PyObject *divisor = POP();
PyObject *dividend = TOP();
PyObject *res;
// NOTE: This optimization keeps us from rolling modulation into
// BINARY_OP/INPLACE_OP. Once we start specializing those, we can
// get rid of BINARY_MODULO/INPLACE_MODULO and implement this trick
// as a specialized variant.
if (PyUnicode_CheckExact(dividend) && (
!PyUnicode_Check(divisor) || PyUnicode_CheckExact(divisor))) {
// fast path; string formatting, but not if the RHS is a str subclass
Expand Down
2 changes: 1 addition & 1 deletion Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -3708,7 +3708,7 @@ addop_binary(struct compiler *c, operator_ty binop, bool inplace)
ADDOP(c, inplace ? INPLACE_MODULO : BINARY_MODULO);
return 1;
case Pow:
// Exponentiation is techncally ternary:
// Exponentiation is technically ternary:
ADDOP(c, inplace ? INPLACE_POWER : BINARY_POWER);
return 1;
case LShift:
Expand Down