[Python-checkins] bpo-46920: Remove code that has no explainer why it was disabled (GH-31814)
vstinner
webhook-mailer at python.org
Mon Mar 14 12:02:50 EDT 2022
https://github.com/python/cpython/commit/e885ac3d5f2fd83617ab75a098aab269b7a446c3
commit: e885ac3d5f2fd83617ab75a098aab269b7a446c3
branch: main
author: Oleg Iarygin <oleg at arhadthedev.net>
committer: vstinner <vstinner at python.org>
date: 2022-03-14T17:02:32+01:00
summary:
bpo-46920: Remove code that has no explainer why it was disabled (GH-31814)
files:
M Modules/_ctypes/_ctypes.c
M Objects/classobject.c
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 481de85fde3ad..9177225f3f929 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -1418,49 +1418,12 @@ static PyGetSetDef WCharArray_getsets[] = {
};
/*
- The next three functions copied from Python's typeobject.c.
+ The next function is copied from Python's typeobject.c.
- They are used to attach methods, members, or getsets to a type *after* it
+ It is used to attach getsets to a type *after* it
has been created: Arrays of characters have additional getsets to treat them
as strings.
*/
-/*
-static int
-add_methods(PyTypeObject *type, PyMethodDef *meth)
-{
- PyObject *dict = type->tp_dict;
- for (; meth->ml_name != NULL; meth++) {
- PyObject *descr;
- descr = PyDescr_NewMethod(type, meth);
- if (descr == NULL)
- return -1;
- if (PyDict_SetItemString(dict, meth->ml_name, descr) < 0) {
- Py_DECREF(descr);
- return -1;
- }
- Py_DECREF(descr);
- }
- return 0;
-}
-
-static int
-add_members(PyTypeObject *type, PyMemberDef *memb)
-{
- PyObject *dict = type->tp_dict;
- for (; memb->name != NULL; memb++) {
- PyObject *descr;
- descr = PyDescr_NewMember(type, memb);
- if (descr == NULL)
- return -1;
- if (PyDict_SetItemString(dict, memb->name, descr) < 0) {
- Py_DECREF(descr);
- return -1;
- }
- Py_DECREF(descr);
- }
- return 0;
-}
-*/
static int
add_getset(PyTypeObject *type, PyGetSetDef *gsp)
diff --git a/Objects/classobject.c b/Objects/classobject.c
index 3b1c25394f152..c75ba572b9624 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -516,22 +516,6 @@ instancemethod_repr(PyObject *self)
return result;
}
-/*
-static long
-instancemethod_hash(PyObject *self)
-{
- long x, y;
- x = (long)self;
- y = PyObject_Hash(PyInstanceMethod_GET_FUNCTION(self));
- if (y == -1)
- return -1;
- x = x ^ y;
- if (x == -1)
- x = -2;
- return x;
-}
-*/
-
PyDoc_STRVAR(instancemethod_doc,
"instancemethod(function)\n\
\n\
@@ -569,7 +553,7 @@ PyTypeObject PyInstanceMethod_Type = {
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
- 0, /*(hashfunc)instancemethod_hash, tp_hash */
+ 0, /* tp_hash */
instancemethod_call, /* tp_call */
0, /* tp_str */
instancemethod_getattro, /* tp_getattro */
More information about the Python-checkins
mailing list