Skip to content

Commit

Permalink
pythongh-112125: Fix None.__ne__(None) returning NotImplemented inste…
Browse files Browse the repository at this point in the history
…ad of False
  • Loading branch information
andrewluotechnologies committed Dec 6, 2023
1 parent f885263 commit e67de67
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Include/internal/pycore_typeobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ extern PyObject* _Py_type_getattro_impl(PyTypeObject *type, PyObject *name,
int *suppress_missing_attribute);
extern PyObject* _Py_type_getattro(PyTypeObject *type, PyObject *name);

extern PyObject* _Py_object_tp_richcompare(PyObject* self, PyObject* other, int op);

extern PyObject* _Py_slot_tp_getattro(PyObject *self, PyObject *name);
extern PyObject* _Py_slot_tp_getattr_hook(PyObject *self, PyObject *name);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix None.__ne__(None) returning NotImplemented instead of False
2 changes: 1 addition & 1 deletion Objects/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -2026,7 +2026,7 @@ PyTypeObject _PyNone_Type = {
0, /*tp_doc */
0, /*tp_traverse */
0, /*tp_clear */
0, /*tp_richcompare */
_Py_object_tp_richcompare, /*tp_richcompare */
0, /*tp_weaklistoffset */
0, /*tp_iter */
0, /*tp_iternext */
Expand Down
6 changes: 6 additions & 0 deletions Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -5625,6 +5625,12 @@ object_richcompare(PyObject *self, PyObject *other, int op)
return res;
}

PyObject*
_Py_object_tp_richcompare(PyObject* self, PyObject* other, int op)
{
return object_richcompare(self, other, op);
}

static PyObject *
object_get_class(PyObject *self, void *closure)
{
Expand Down

0 comments on commit e67de67

Please sign in to comment.