Skip to content

Commit 29ea68b

Browse files
authored
Revert "bpo-46131: add fastpath for PyFloat_Check() (GH-30200)" (GH-30208)
This reverts commit 2ef06d4.
1 parent 2ef06d4 commit 29ea68b

File tree

7 files changed

+0
-23
lines changed

7 files changed

+0
-23
lines changed

Doc/c-api/typeobj.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,6 @@ and :c:type:`PyType_Type` effectively act as defaults.)
11451145
.. XXX Document more flags here?
11461146
11471147
1148-
.. data:: Py_TPFLAGS_FLOAT_SUBCLASS
11491148
.. data:: Py_TPFLAGS_LONG_SUBCLASS
11501149
.. data:: Py_TPFLAGS_LIST_SUBCLASS
11511150
.. data:: Py_TPFLAGS_TUPLE_SUBCLASS

Include/floatobject.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ extern "C" {
1414
PyAPI_DATA(PyTypeObject) PyFloat_Type;
1515

1616
#define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type)
17-
#define PyFloat_Check(op) \
18-
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_FLOAT_SUBCLASS)
1917
#define PyFloat_CheckExact(op) Py_IS_TYPE(op, &PyFloat_Type)
2018

2119
#ifdef Py_NAN

Include/object.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,6 @@ given type object has a specified feature.
397397
#define _Py_TPFLAGS_MATCH_SELF (1UL << 22)
398398

399399
/* These flags are used to determine if a type is a subclass. */
400-
#define Py_TPFLAGS_FLOAT_SUBCLASS (1UL << 23)
401400
#define Py_TPFLAGS_LONG_SUBCLASS (1UL << 24)
402401
#define Py_TPFLAGS_LIST_SUBCLASS (1UL << 25)
403402
#define Py_TPFLAGS_TUPLE_SUBCLASS (1UL << 26)

Misc/NEWS.d/next/C API/2021-12-19-13-02-59.bpo-46131.ZBWQtO.rst

Lines changed: 0 additions & 2 deletions
This file was deleted.

Objects/floatobject.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1959,7 +1959,6 @@ PyTypeObject PyFloat_Type = {
19591959
0, /* tp_setattro */
19601960
0, /* tp_as_buffer */
19611961
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
1962-
Py_TPFLAGS_FLOAT_SUBCLASS |
19631962
_Py_TPFLAGS_MATCH_SELF, /* tp_flags */
19641963
float_new__doc__, /* tp_doc */
19651964
0, /* tp_traverse */

Objects/typeobject.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5783,9 +5783,6 @@ inherit_special(PyTypeObject *type, PyTypeObject *base)
57835783
else if (PyType_IsSubtype(base, &PyDict_Type)) {
57845784
type->tp_flags |= Py_TPFLAGS_DICT_SUBCLASS;
57855785
}
5786-
else if (PyType_IsSubtype(base, &PyFloat_Type)) {
5787-
type->tp_flags |= Py_TPFLAGS_FLOAT_SUBCLASS;
5788-
}
57895786
if (PyType_HasFeature(base, _Py_TPFLAGS_MATCH_SELF)) {
57905787
type->tp_flags |= _Py_TPFLAGS_MATCH_SELF;
57915788
}

Tools/gdb/libpython.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ def _sizeof_void_p():
8585

8686
Py_TPFLAGS_MANAGED_DICT = (1 << 4)
8787
Py_TPFLAGS_HEAPTYPE = (1 << 9)
88-
Py_TPFLAGS_FLOAT_SUBCLASS = (1 << 23)
8988
Py_TPFLAGS_LONG_SUBCLASS = (1 << 24)
9089
Py_TPFLAGS_LIST_SUBCLASS = (1 << 25)
9190
Py_TPFLAGS_TUPLE_SUBCLASS = (1 << 26)
@@ -380,8 +379,6 @@ def subclass_from_type(cls, t):
380379
if tp_flags & Py_TPFLAGS_HEAPTYPE:
381380
return HeapTypeObjectPtr
382381

383-
if tp_flags & Py_TPFLAGS_FLOAT_SUBCLASS:
384-
return PyFloatObjectPtr
385382
if tp_flags & Py_TPFLAGS_LONG_SUBCLASS:
386383
return PyLongObjectPtr
387384
if tp_flags & Py_TPFLAGS_LIST_SUBCLASS:
@@ -913,16 +910,6 @@ class PyNoneStructPtr(PyObjectPtr):
913910
def proxyval(self, visited):
914911
return None
915912

916-
class PyFloatObjectPtr(PyObjectPtr):
917-
_typename = 'PyFloatObject'
918-
919-
def proxyval(self, visited):
920-
return self.field('ob_fval')
921-
922-
def write_repr(self, out, visited):
923-
proxy = self.proxyval(visited)
924-
out.write("%s" % proxy)
925-
926913
class PyFrameObjectPtr(PyObjectPtr):
927914
_typename = 'PyFrameObject'
928915

0 commit comments

Comments
 (0)