Skip to content

Commit e885ac3

Browse files
authored
bpo-46920: Remove code that has no explainer why it was disabled (GH-31814)
1 parent 11c25b8 commit e885ac3

File tree

2 files changed

+3
-56
lines changed

2 files changed

+3
-56
lines changed

Modules/_ctypes/_ctypes.c

+2-39
Original file line numberDiff line numberDiff line change
@@ -1418,49 +1418,12 @@ static PyGetSetDef WCharArray_getsets[] = {
14181418
};
14191419

14201420
/*
1421-
The next three functions copied from Python's typeobject.c.
1421+
The next function is copied from Python's typeobject.c.
14221422
1423-
They are used to attach methods, members, or getsets to a type *after* it
1423+
It is used to attach getsets to a type *after* it
14241424
has been created: Arrays of characters have additional getsets to treat them
14251425
as strings.
14261426
*/
1427-
/*
1428-
static int
1429-
add_methods(PyTypeObject *type, PyMethodDef *meth)
1430-
{
1431-
PyObject *dict = type->tp_dict;
1432-
for (; meth->ml_name != NULL; meth++) {
1433-
PyObject *descr;
1434-
descr = PyDescr_NewMethod(type, meth);
1435-
if (descr == NULL)
1436-
return -1;
1437-
if (PyDict_SetItemString(dict, meth->ml_name, descr) < 0) {
1438-
Py_DECREF(descr);
1439-
return -1;
1440-
}
1441-
Py_DECREF(descr);
1442-
}
1443-
return 0;
1444-
}
1445-
1446-
static int
1447-
add_members(PyTypeObject *type, PyMemberDef *memb)
1448-
{
1449-
PyObject *dict = type->tp_dict;
1450-
for (; memb->name != NULL; memb++) {
1451-
PyObject *descr;
1452-
descr = PyDescr_NewMember(type, memb);
1453-
if (descr == NULL)
1454-
return -1;
1455-
if (PyDict_SetItemString(dict, memb->name, descr) < 0) {
1456-
Py_DECREF(descr);
1457-
return -1;
1458-
}
1459-
Py_DECREF(descr);
1460-
}
1461-
return 0;
1462-
}
1463-
*/
14641427

14651428
static int
14661429
add_getset(PyTypeObject *type, PyGetSetDef *gsp)

Objects/classobject.c

+1-17
Original file line numberDiff line numberDiff line change
@@ -516,22 +516,6 @@ instancemethod_repr(PyObject *self)
516516
return result;
517517
}
518518

519-
/*
520-
static long
521-
instancemethod_hash(PyObject *self)
522-
{
523-
long x, y;
524-
x = (long)self;
525-
y = PyObject_Hash(PyInstanceMethod_GET_FUNCTION(self));
526-
if (y == -1)
527-
return -1;
528-
x = x ^ y;
529-
if (x == -1)
530-
x = -2;
531-
return x;
532-
}
533-
*/
534-
535519
PyDoc_STRVAR(instancemethod_doc,
536520
"instancemethod(function)\n\
537521
\n\
@@ -569,7 +553,7 @@ PyTypeObject PyInstanceMethod_Type = {
569553
0, /* tp_as_number */
570554
0, /* tp_as_sequence */
571555
0, /* tp_as_mapping */
572-
0, /*(hashfunc)instancemethod_hash, tp_hash */
556+
0, /* tp_hash */
573557
instancemethod_call, /* tp_call */
574558
0, /* tp_str */
575559
instancemethod_getattro, /* tp_getattro */

0 commit comments

Comments
 (0)