Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove some old changes
  • Loading branch information
brandtbucher committed Nov 8, 2021
commit 6c6b78f5cc63e9ab587f60b36ae5a6172cf9a242
3 changes: 2 additions & 1 deletion Doc/library/dis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,8 @@ the original TOS1.

.. opcode:: BINARY_OP (op)

Implements the remaining binary operators (depending on the value of *op*).
Implements the binary and in-place operators (depending on the value of
*op*).

.. versionadded:: 3.11

Expand Down
3 changes: 0 additions & 3 deletions Include/internal/pycore_abstract.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ _PyIndex_Check(PyObject *obj)
return (tp_as_number != NULL && tp_as_number->nb_index != NULL);
}

PyObject *_PyNumber_Op(PyObject *o1, PyObject *o2, unsigned op);
PyObject *_PyNumber_InPlaceOp(PyObject *o1, PyObject *o2, unsigned op);

#ifdef __cplusplus
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions Lib/importlib/_bootstrap_external.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ def _write_atomic(path, data, mode=0o666):
# Python 3.11a1 3461 (JUMP_ABSOLUTE must jump backwards)
# Python 3.11a2 3462 (bpo-44511: remove COPY_DICT_WITHOUT_KEYS, change
# MATCH_CLASS and MATCH_KEYS, and add COPY)
# Python 3.11a3 3464 (Merge numeric BINARY_*/INPLACE_* into BINARY_OP)
# Python 3.11a3 3463 (Merge numeric BINARY_*/INPLACE_* into BINARY_OP)

#
# MAGIC must change whenever the bytecode emitted by the compiler may no
Expand All @@ -376,7 +376,7 @@ def _write_atomic(path, data, mode=0o666):
# Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array
# in PC/launcher.c must also be updated.

MAGIC_NUMBER = (3464).to_bytes(2, 'little') + b'\r\n'
MAGIC_NUMBER = (3463).to_bytes(2, 'little') + b'\r\n'
_RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c

_PYCACHE = '__pycache__'
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ def assertOpcodeSourcePositionIs(self, code, opcode,
for instr, position in zip(dis.Bytecode(code), code.co_positions()):
if instr.opname == opcode:
occurrence -= 1
if occurrence == 0:
if not occurrence:
self.assertEqual(position[0], line)
self.assertEqual(position[1], end_line)
self.assertEqual(position[2], column)
Expand Down
41 changes: 0 additions & 41 deletions Objects/abstract.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* Abstract Object Interface (many thanks to Jim Fulton) */

#include "Python.h"
#include "opcode.h"
#include "pycore_abstract.h" // _PyIndex_Check()
#include "pycore_call.h" // _PyObject_CallNoArgs()
#include "pycore_ceval.h" // _Py_EnterRecursiveCall()
Expand Down Expand Up @@ -1715,46 +1714,6 @@ PyNumber_ToBase(PyObject *n, int base)
return res;
}

typedef struct {
const int slot;
const char name[3];
const int islot;
const char iname[4];
} nb_info;

#define NB_INFO(name, slot) \
{NB_SLOT(nb_##slot), name, NB_SLOT(nb_inplace_##slot), name "="}

static nb_info nb_infos[] = {
[NB_AND] = NB_INFO("&", and),
[NB_FLOOR_DIVIDE] = NB_INFO("//", floor_divide),
[NB_LSHIFT] = NB_INFO("<<", lshift),
[NB_MATRIX_MULTIPLY] = NB_INFO("@", matrix_multiply),
[NB_OR] = NB_INFO("|", or),
[NB_RSHIFT] = NB_INFO(">>", rshift),
[NB_SUBTRACT] = NB_INFO("-", subtract),
[NB_TRUE_DIVIDE] = NB_INFO("/", true_divide),
[NB_XOR] = NB_INFO("^", xor),
};

#undef NB_INFO

PyObject *
_PyNumber_Op(PyObject *o1, PyObject *o2, unsigned op)
{
assert(op < sizeof(nb_infos) / sizeof(nb_info));
nb_info *ni = &nb_infos[op];
return binary_op(o1, o2, ni->slot, ni->name);
}

PyObject *
_PyNumber_InPlaceOp(PyObject *o1, PyObject *o2, unsigned op)
{
assert(op < sizeof(nb_infos) / sizeof(nb_info));
nb_info *ni = &nb_infos[op];
return binary_iop(o1, o2, ni->islot, ni->slot, ni->iname);
}


/* Operations on sequences */

Expand Down