Skip to content

Revert "bpo-46131: add fastpath for PyFloat_Check()" #30208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion Doc/c-api/typeobj.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,6 @@ and :c:type:`PyType_Type` effectively act as defaults.)
.. XXX Document more flags here?


.. data:: Py_TPFLAGS_FLOAT_SUBCLASS
.. data:: Py_TPFLAGS_LONG_SUBCLASS
.. data:: Py_TPFLAGS_LIST_SUBCLASS
.. data:: Py_TPFLAGS_TUPLE_SUBCLASS
Expand Down
2 changes: 0 additions & 2 deletions Include/floatobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ extern "C" {
PyAPI_DATA(PyTypeObject) PyFloat_Type;

#define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type)
#define PyFloat_Check(op) \
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_FLOAT_SUBCLASS)
#define PyFloat_CheckExact(op) Py_IS_TYPE(op, &PyFloat_Type)

#ifdef Py_NAN
Expand Down
1 change: 0 additions & 1 deletion Include/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ given type object has a specified feature.
#define _Py_TPFLAGS_MATCH_SELF (1UL << 22)

/* These flags are used to determine if a type is a subclass. */
#define Py_TPFLAGS_FLOAT_SUBCLASS (1UL << 23)
#define Py_TPFLAGS_LONG_SUBCLASS (1UL << 24)
#define Py_TPFLAGS_LIST_SUBCLASS (1UL << 25)
#define Py_TPFLAGS_TUPLE_SUBCLASS (1UL << 26)
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion Objects/floatobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1959,7 +1959,6 @@ PyTypeObject PyFloat_Type = {
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
Py_TPFLAGS_FLOAT_SUBCLASS |
_Py_TPFLAGS_MATCH_SELF, /* tp_flags */
float_new__doc__, /* tp_doc */
0, /* tp_traverse */
Expand Down
3 changes: 0 additions & 3 deletions Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -5783,9 +5783,6 @@ inherit_special(PyTypeObject *type, PyTypeObject *base)
else if (PyType_IsSubtype(base, &PyDict_Type)) {
type->tp_flags |= Py_TPFLAGS_DICT_SUBCLASS;
}
else if (PyType_IsSubtype(base, &PyFloat_Type)) {
type->tp_flags |= Py_TPFLAGS_FLOAT_SUBCLASS;
}
if (PyType_HasFeature(base, _Py_TPFLAGS_MATCH_SELF)) {
type->tp_flags |= _Py_TPFLAGS_MATCH_SELF;
}
Expand Down
13 changes: 0 additions & 13 deletions Tools/gdb/libpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ def _sizeof_void_p():

Py_TPFLAGS_MANAGED_DICT = (1 << 4)
Py_TPFLAGS_HEAPTYPE = (1 << 9)
Py_TPFLAGS_FLOAT_SUBCLASS = (1 << 23)
Py_TPFLAGS_LONG_SUBCLASS = (1 << 24)
Py_TPFLAGS_LIST_SUBCLASS = (1 << 25)
Py_TPFLAGS_TUPLE_SUBCLASS = (1 << 26)
Expand Down Expand Up @@ -380,8 +379,6 @@ def subclass_from_type(cls, t):
if tp_flags & Py_TPFLAGS_HEAPTYPE:
return HeapTypeObjectPtr

if tp_flags & Py_TPFLAGS_FLOAT_SUBCLASS:
return PyFloatObjectPtr
if tp_flags & Py_TPFLAGS_LONG_SUBCLASS:
return PyLongObjectPtr
if tp_flags & Py_TPFLAGS_LIST_SUBCLASS:
Expand Down Expand Up @@ -913,16 +910,6 @@ class PyNoneStructPtr(PyObjectPtr):
def proxyval(self, visited):
return None

class PyFloatObjectPtr(PyObjectPtr):
_typename = 'PyFloatObject'

def proxyval(self, visited):
return self.field('ob_fval')

def write_repr(self, out, visited):
proxy = self.proxyval(visited)
out.write("%s" % proxy)

class PyFrameObjectPtr(PyObjectPtr):
_typename = 'PyFrameObject'

Expand Down