Skip to content

Commit 6b9eca9

Browse files
colesburykumaraditya303mpage
authored
Apply suggestions from code review
Co-authored-by: Kumar Aditya <kumaraditya@python.org> Co-authored-by: mpage <mpage@cs.stanford.edu>
1 parent a782c6b commit 6b9eca9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

InternalDocs/stackrefs.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ They carry metadata to track ownership and support optimizations such as tagged
77

88
- A `_PyStackRef` is a tagged pointer-sized value (see `Include/internal/pycore_stackref.h`).
99
- Tag bits distinguish three cases:
10-
- `Py_TAG_REFCNT` clear - reference count lives on the pointed-to object.
10+
- `Py_TAG_REFCNT` unset - reference count lives on the pointed-to object.
1111
- `Py_TAG_REFCNT` set - ownership is "borrowed" (no refcount to drop on close) or the object is immortal.
12-
- `Py_INT_TAG` - tagged small integer stored directly in the stackref (no heap allocation).
12+
- `Py_INT_TAG` set - tagged small integer stored directly in the stackref (no heap allocation).
1313
- Special constants: `PyStackRef_NULL`, `PyStackRef_ERROR`, and embedded `None`/`True`/`False`.
1414

1515
In GIL builds, most objects carry their refcount; tagged borrowed refs skip decref on close. In free
1616
threading builds, the tag is also used to mark deferred refcounted objects so the GC can see them and
17-
to avoid refcount contention for short-lived stack values.
17+
to avoid refcount contention on commonly shared objects.
1818

1919
## Converting to and from PyObject*
2020

@@ -67,7 +67,7 @@ With `Py_GIL_DISABLED`, `Py_TAG_DEFERRED` is an alias for `Py_TAG_REFCNT`.
6767
Objects that support deferred reference counting can be pushed to the evaluation
6868
stack and stored in local variables without directly incrementing the reference
6969
count because they are only freed during cyclic garbage collection. This avoids
70-
reference count contention on short-lived values such as methods and types. The GC
70+
reference count contention on commonly shared objects such as methods and types. The GC
7171
scans each thread's locals and evaluation stack to keep objects that use
7272
deferred reference counting alive.
7373

0 commit comments

Comments
 (0)