diff options
author | Matti Picus <matti.picus@gmail.com> | 2021-12-19 20:24:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-19 20:24:30 (GMT) |
commit | 2ef06d412531d1163dbc72877c88aedf3ed82a25 (patch) | |
tree | 9a8a1f60d82447795da0345c00e561c15448cd1b /Tools | |
parent | aeb9ef4c7287fe367b6e9adcf1c5f994d5bc1a09 (diff) | |
download | cpython-2ef06d412531d1163dbc72877c88aedf3ed82a25.zip cpython-2ef06d412531d1163dbc72877c88aedf3ed82a25.tar.gz cpython-2ef06d412531d1163dbc72877c88aedf3ed82a25.tar.bz2 |
bpo-46131: add fastpath for PyFloat_Check() (#30200)
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/gdb/libpython.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py index a0a95e3..41d1c3c 100755 --- a/Tools/gdb/libpython.py +++ b/Tools/gdb/libpython.py @@ -85,6 +85,7 @@ _is_pep393 = None 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) @@ -379,6 +380,8 @@ class PyObjectPtr(object): 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: @@ -910,6 +913,16 @@ 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' |