Skip to content

Commit e2e73df

Browse files
committed
Address review comments
1 parent 3514aa1 commit e2e73df

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed

Include/pythonrun.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,22 @@ PyAPI_DATA(int) (*PyOS_InputHook)(void);
2626
* apart. In practice, that means it must be larger than the C
2727
* stack consumption of PyEval_EvalDefault */
2828
#if defined(_Py_ADDRESS_SANITIZER) || defined(_Py_THREAD_SANITIZER)
29-
# define PYOS_LOG_STACK_MARGIN 12
29+
# define PYOS_LOG2_STACK_MARGIN 12
3030
#elif defined(Py_DEBUG) && defined(WIN32)
31-
# define PYOS_LOG_STACK_MARGIN 12
31+
# define PYOS_LOG2_STACK_MARGIN 12
3232
#elif defined(__wasi__)
3333
/* Web assembly has two stacks, so this isn't really a size */
34-
# define PYOS_LOG_STACK_MARGIN 9
34+
# define PYOS_LOG2_STACK_MARGIN 9
3535
#else
36-
# define PYOS_LOG_STACK_MARGIN 11
36+
# define PYOS_LOG2_STACK_MARGIN 11
3737
#endif
38-
#define PYOS_STACK_MARGIN (1 << PYOS_LOG_STACK_MARGIN)
38+
#define PYOS_STACK_MARGIN (1 << PYOS_LOG2_STACK_MARGIN)
3939
#define PYOS_STACK_MARGIN_BYTES (PYOS_STACK_MARGIN * sizeof(void *))
4040

4141
#if SIZEOF_VOID_P == 8
42-
#define PYOS_STACK_MARGIN_SHIFT (PYOS_LOG_STACK_MARGIN + 3)
42+
#define PYOS_STACK_MARGIN_SHIFT (PYOS_LOG2_STACK_MARGIN + 3)
4343
#else
44-
#define PYOS_STACK_MARGIN_SHIFT (PYOS_LOG_STACK_MARGIN + 2)
44+
#define PYOS_STACK_MARGIN_SHIFT (PYOS_LOG2_STACK_MARGIN + 2)
4545
#endif
4646

4747

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Prevents against stack overflows when calling Py_DECREF. Third-party
1+
Prevents against stack overflows when calling :c:func:`Py_DECREF`. Third-party
22
extension objects no longer need to use the "trashcan" mechanism, as
3-
protection is now built into the ``Py_DECREF`` macro.
3+
protection is now built into the :c:func:`Py_DECREF` macro.

Objects/capsule.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,7 @@ static void
287287
capsule_dealloc(PyObject *op)
288288
{
289289
PyCapsule *capsule = _PyCapsule_CAST(op);
290-
if (_PyObject_GC_IS_TRACKED(op)) {
291-
PyObject_GC_UnTrack(op);
292-
}
290+
PyObject_GC_UnTrack(op);
293291
if (capsule->destructor) {
294292
capsule->destructor(op);
295293
}

Objects/object.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2912,7 +2912,7 @@ _PyTrash_thread_deposit_object(PyThreadState *tstate, PyObject *op)
29122912
#ifdef Py_GIL_DISABLED
29132913
op->ob_tid = (uintptr_t)tstate->delete_later;
29142914
#else
2915-
/* Store the pointer in the refcnt field.
2915+
/* Store the delete_later pointer in the refcnt field.
29162916
* As this object may still be tracked by the GC,
29172917
* it is important that we never store 0 (NULL). */
29182918
uintptr_t refcnt = (uintptr_t)tstate->delete_later;
@@ -2935,6 +2935,8 @@ _PyTrash_thread_destroy_chain(PyThreadState *tstate)
29352935
op->ob_tid = 0;
29362936
_Py_atomic_store_ssize_relaxed(&op->ob_ref_shared, _Py_REF_MERGED);
29372937
#else
2938+
/* Get the delete_later pointer from the refcnt field.
2939+
* See _PyTrash_thread_deposit_object(). */
29382940
uintptr_t refcnt = *((uintptr_t*)op);
29392941
tstate->delete_later = (PyObject *)(refcnt - 1);
29402942
op->ob_refcnt = 0;

Objects/typeobject.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2654,7 +2654,6 @@ subtype_dealloc(PyObject *self)
26542654
if (type_needs_decref) {
26552655
_Py_DECREF_TYPE(type);
26562656
}
2657-
26582657
}
26592658

26602659
static PyTypeObject *solid_base(PyTypeObject *type);

0 commit comments

Comments
 (0)