Skip to content

Commit 4dd5461

Browse files
authored
Merge branch 'main' into fix-sqrtprod-subnormal
2 parents 19f8746 + ce841a9 commit 4dd5461

11 files changed

Lines changed: 1036 additions & 39 deletions

File tree

‎Doc/library/__main__.rst‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _`__main__`:
2+
13
:mod:`!__main__` --- Top-level code environment
24
===============================================
35

‎Doc/reference/datamodel.rst‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2992,6 +2992,8 @@ automatic property creation, proxies, frameworks, and automatic resource
29922992
locking/synchronization.
29932993

29942994

2995+
.. _customize-instance-subclass-checks:
2996+
29952997
Customizing instance and subclass checks
29962998
----------------------------------------
29972999

‎Doc/tools/extensions/pydoc_topics.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,14 @@
4141
"callable-types",
4242
"calls",
4343
"class",
44+
"class-customization",
4445
"comparisons",
4546
"compound",
4647
"context-managers",
4748
"continue",
4849
"conversions",
4950
"customization",
51+
"customize-instance-subclass-checks",
5052
"debugger",
5153
"del",
5254
"dict",
@@ -70,6 +72,7 @@
7072
"lambda",
7173
"lazy",
7274
"lists",
75+
"name_equals_main",
7376
"match",
7477
"naming",
7578
"nonlocal",
@@ -102,6 +105,7 @@
102105
"while",
103106
"with",
104107
"yield",
108+
"__main__",
105109
})
106110

107111

‎Doc/whatsnew/3.16.rst‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,9 @@ pydoc
614614
inherited from other classes are collapsed by default.
615615
(Contributed by Serhiy Storchaka in :gh:`153906`.)
616616

617+
* Add help for more special names to the built-in :func:`help` function.
618+
(Contributed by Adam Hartz in :gh:`137966`.)
619+
617620

618621
pickle
619622
------

‎Include/internal/pycore_gc.h‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,26 @@ static inline int _PyObject_GC_IS_TRACKED(PyObject *op) {
8080
}
8181
#define _PyObject_GC_IS_TRACKED(op) _PyObject_GC_IS_TRACKED(_Py_CAST(PyObject*, op))
8282

83+
// Fast inlined version of PyType_IS_GC()
84+
static inline int
85+
_PyType_IS_GC(PyTypeObject *type)
86+
{
87+
return (type->tp_flags & Py_TPFLAGS_HAVE_GC) != 0;
88+
}
89+
90+
// Fast inlined version of PyObject_IS_GC()
91+
static inline int
92+
_PyObject_IS_GC(PyObject *obj)
93+
{
94+
PyTypeObject *type = Py_TYPE(obj);
95+
return (_PyType_IS_GC(type)
96+
&& (type->tp_is_gc == NULL || type->tp_is_gc(obj)));
97+
}
98+
8399
/* True if the object may be tracked by the GC in the future, or already is.
84100
This can be useful to implement some optimizations. */
85101
static inline int _PyObject_GC_MAY_BE_TRACKED(PyObject *obj) {
86-
if (!PyObject_IS_GC(obj)) {
102+
if (!_PyObject_IS_GC(obj)) {
87103
return 0;
88104
}
89105
if (PyTuple_CheckExact(obj)) {

‎Include/internal/pycore_object.h‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -816,18 +816,6 @@ _PyObject_GET_WEAKREFS_LISTPTR_FROM_OFFSET(PyObject *op)
816816
return (PyWeakReference **)((char *)op + offset);
817817
}
818818

819-
// Fast inlined version of PyType_IS_GC()
820-
#define _PyType_IS_GC(t) _PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)
821-
822-
// Fast inlined version of PyObject_IS_GC()
823-
static inline int
824-
_PyObject_IS_GC(PyObject *obj)
825-
{
826-
PyTypeObject *type = Py_TYPE(obj);
827-
return (_PyType_IS_GC(type)
828-
&& (type->tp_is_gc == NULL || type->tp_is_gc(obj)));
829-
}
830-
831819
// Fast inlined version of PyObject_Hash(). Dictionaries are very
832820
// likely to include string keys (class and instance attributes,
833821
// json, ...) so we include a fast path for strings.

0 commit comments

Comments
 (0)