Skip to content

Commit 9230fa2

Browse files
committed
Fix stray changes.
1 parent 2886803 commit 9230fa2

File tree

5 files changed

+30
-28
lines changed

5 files changed

+30
-28
lines changed

Include/cpython/pystate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ PyAPI_FUNC(void) _PyInterpreterState_SetEvalFrameFunc(
322322
PyInterpreterState *interp,
323323
_PyFrameEvalFunction eval_frame);
324324

325-
/* Interpreter locks */
325+
/* Interpreter guards */
326326

327327
typedef uintptr_t PyInterpreterGuard;
328328
typedef uintptr_t PyInterpreterView;

Include/internal/pycore_pystate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ _Py_RecursionLimit_GetMargin(PyThreadState *tstate)
339339
}
340340

341341
// Exports for '_testinternalcapi' shared extension
342-
PyAPI_FUNC(Py_ssize_t) _PyInterpreterState_LockCountdown(PyInterpreterState *interp);
342+
PyAPI_FUNC(Py_ssize_t) _PyInterpreterState_GuardCountdown(PyInterpreterState *interp);
343343

344344
#ifdef __cplusplus
345345
}

Modules/_testcapimodule.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2562,6 +2562,7 @@ toggle_reftrace_printer(PyObject *ob, PyObject *arg)
25622562
Py_RETURN_NONE;
25632563
}
25642564

2565+
25652566
typedef struct {
25662567
PyObject_HEAD
25672568
} ManagedWeakrefNoGCObject;

Modules/_testinternalcapi.c

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2460,28 +2460,6 @@ check_threadstate_set_stack_protection(PyThreadState *tstate,
24602460
assert(ts->c_stack_soft_limit < ts->c_stack_top);
24612461
}
24622462

2463-
#define NUM_GUARDS 100
2464-
2465-
static PyObject *
2466-
test_interp_guard_countdown(PyObject *self, PyObject *unused)
2467-
{
2468-
PyInterpreterState *interp = PyInterpreterState_Get();
2469-
assert(_PyInterpreterState_LockCountdown(interp) == 0);
2470-
PyInterpreterGuard guards[NUM_GUARDS];
2471-
for (int i = 0; i < NUM_GUARDS; ++i) {
2472-
guards[i] = PyInterpreterGuard_FromCurrent();
2473-
assert(guards[i] != 0);
2474-
assert(_PyInterpreterState_LockCountdown(interp) == i + 1);
2475-
}
2476-
2477-
for (int i = 0; i < NUM_GUARDS; ++i) {
2478-
PyInterpreterGuard_Release(guards[i]);
2479-
assert(_PyInterpreterState_LockCountdown(interp) == (NUM_GUARDS - i - 1));
2480-
}
2481-
2482-
Py_RETURN_NONE;
2483-
}
2484-
24852463

24862464
static PyObject *
24872465
test_threadstate_set_stack_protection(PyObject *self, PyObject *Py_UNUSED(args))
@@ -2519,6 +2497,28 @@ test_threadstate_set_stack_protection(PyObject *self, PyObject *Py_UNUSED(args))
25192497
Py_RETURN_NONE;
25202498
}
25212499

2500+
#define NUM_GUARDS 100
2501+
2502+
static PyObject *
2503+
test_interp_guard_countdown(PyObject *self, PyObject *unused)
2504+
{
2505+
PyInterpreterState *interp = PyInterpreterState_Get();
2506+
assert(_PyInterpreterState_GuardCountdown(interp) == 0);
2507+
PyInterpreterGuard guards[NUM_GUARDS];
2508+
for (int i = 0; i < NUM_GUARDS; ++i) {
2509+
guards[i] = PyInterpreterGuard_FromCurrent();
2510+
assert(guards[i] != 0);
2511+
assert(_PyInterpreterState_GuardCountdown(interp) == i + 1);
2512+
}
2513+
2514+
for (int i = 0; i < NUM_GUARDS; ++i) {
2515+
PyInterpreterGuard_Release(guards[i]);
2516+
assert(_PyInterpreterState_GuardCountdown(interp) == (NUM_GUARDS - i - 1));
2517+
}
2518+
2519+
Py_RETURN_NONE;
2520+
}
2521+
25222522
static PyObject *
25232523
test_interp_view_countdown(PyObject *self, PyObject *unused)
25242524
{
@@ -2527,20 +2527,20 @@ test_interp_view_countdown(PyObject *self, PyObject *unused)
25272527
if (view == 0) {
25282528
return NULL;
25292529
}
2530-
assert(_PyInterpreterState_LockCountdown(interp) == 0);
2530+
assert(_PyInterpreterState_GuardCountdown(interp) == 0);
25312531

25322532
PyInterpreterGuard guards[NUM_GUARDS];
25332533

25342534
for (int i = 0; i < NUM_GUARDS; ++i) {
25352535
guards[i] = PyInterpreterGuard_FromView(view);
25362536
assert(guards[i] != 0);
25372537
assert(PyInterpreterGuard_GetInterpreter(guards[i]) == interp);
2538-
assert(_PyInterpreterState_LockCountdown(interp) == i + 1);
2538+
assert(_PyInterpreterState_GuardCountdown(interp) == i + 1);
25392539
}
25402540

25412541
for (int i = 0; i < NUM_GUARDS; ++i) {
25422542
PyInterpreterGuard_Release(guards[i]);
2543-
assert(_PyInterpreterState_LockCountdown(interp) == (NUM_GUARDS - i - 1));
2543+
assert(_PyInterpreterState_GuardCountdown(interp) == (NUM_GUARDS - i - 1));
25442544
}
25452545

25462546
PyInterpreterView_Close(view);

Python/pystate.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1560,6 +1560,7 @@ new_threadstate(PyInterpreterState *interp, int whence)
15601560
}
15611561
#endif
15621562

1563+
15631564
#ifdef Py_STATS
15641565
// The PyStats structure is quite large and is allocated separated from tstate.
15651566
if (!_PyStats_ThreadInit(interp, tstate)) {
@@ -3186,7 +3187,7 @@ _Py_GetMainConfig(void)
31863187
}
31873188

31883189
Py_ssize_t
3189-
_PyInterpreterState_LockCountdown(PyInterpreterState *interp)
3190+
_PyInterpreterState_GuardCountdown(PyInterpreterState *interp)
31903191
{
31913192
assert(interp != NULL);
31923193
return _Py_atomic_load_ssize_relaxed(&interp->finalization_guards.countdown);

0 commit comments

Comments
 (0)