Skip to content

Commit ff455e5

Browse files
committed
Rename _PYOS to _PyOS
1 parent 175f103 commit ff455e5

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

Include/internal/pycore_pystate.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ extern "C" {
88
# error "this header requires Py_BUILD_CORE define"
99
#endif
1010

11-
#include "pycore_pythonrun.h" // _PYOS_STACK_MARGIN_SHIFT
11+
#include "pycore_pythonrun.h" // _PyOS_STACK_MARGIN_SHIFT
1212
#include "pycore_typedefs.h" // _PyRuntimeState
1313
#include "pycore_tstate.h"
1414

@@ -326,7 +326,7 @@ _Py_RecursionLimit_GetMargin(PyThreadState *tstate)
326326
_PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate;
327327
assert(_tstate->c_stack_hard_limit != 0);
328328
intptr_t here_addr = _Py_get_machine_stack_pointer();
329-
return Py_ARITHMETIC_RIGHT_SHIFT(intptr_t, here_addr - (intptr_t)_tstate->c_stack_soft_limit, _PYOS_STACK_MARGIN_SHIFT);
329+
return Py_ARITHMETIC_RIGHT_SHIFT(intptr_t, here_addr - (intptr_t)_tstate->c_stack_soft_limit, _PyOS_STACK_MARGIN_SHIFT);
330330
}
331331

332332
#ifdef __cplusplus

Include/internal/pycore_pythonrun.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@ extern const char* _Py_SourceAsString(
3939
* apart. In practice, that means it must be larger than the C
4040
* stack consumption of PyEval_EvalDefault */
4141
#if defined(_Py_ADDRESS_SANITIZER) || defined(_Py_THREAD_SANITIZER)
42-
# define _PYOS_LOG2_STACK_MARGIN 12
42+
# define _PyOS_LOG2_STACK_MARGIN 12
4343
#elif defined(Py_DEBUG) && defined(WIN32)
44-
# define _PYOS_LOG2_STACK_MARGIN 12
44+
# define _PyOS_LOG2_STACK_MARGIN 12
4545
#else
46-
# define _PYOS_LOG2_STACK_MARGIN 11
46+
# define _PyOS_LOG2_STACK_MARGIN 11
4747
#endif
48-
#define _PYOS_STACK_MARGIN (1 << _PYOS_LOG2_STACK_MARGIN)
49-
#define _PYOS_STACK_MARGIN_BYTES (_PYOS_STACK_MARGIN * sizeof(void *))
48+
#define _PyOS_STACK_MARGIN (1 << _PyOS_LOG2_STACK_MARGIN)
49+
#define _PyOS_STACK_MARGIN_BYTES (_PyOS_STACK_MARGIN * sizeof(void *))
5050

5151
#if SIZEOF_VOID_P == 8
52-
# define _PYOS_STACK_MARGIN_SHIFT (_PYOS_LOG2_STACK_MARGIN + 3)
52+
# define _PyOS_STACK_MARGIN_SHIFT (_PyOS_LOG2_STACK_MARGIN + 3)
5353
#else
54-
# define _PYOS_STACK_MARGIN_SHIFT (_PYOS_LOG2_STACK_MARGIN + 2)
54+
# define _PyOS_STACK_MARGIN_SHIFT (_PyOS_LOG2_STACK_MARGIN + 2)
5555
#endif
5656

5757

Modules/_testinternalcapi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ get_c_recursion_remaining(PyObject *self, PyObject *Py_UNUSED(args))
120120
PyThreadState *tstate = _PyThreadState_GET();
121121
uintptr_t here_addr = _Py_get_machine_stack_pointer();
122122
_PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate;
123-
int remaining = (int)((here_addr - _tstate->c_stack_soft_limit) / _PYOS_STACK_MARGIN_BYTES * 50);
123+
int remaining = (int)((here_addr - _tstate->c_stack_soft_limit) / _PyOS_STACK_MARGIN_BYTES * 50);
124124
return PyLong_FromLong(remaining);
125125
}
126126

Python/ceval.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -346,13 +346,13 @@ _Py_ReachedRecursionLimitWithMargin(PyThreadState *tstate, int margin_count)
346346
{
347347
uintptr_t here_addr = _Py_get_machine_stack_pointer();
348348
_PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate;
349-
if (here_addr > _tstate->c_stack_soft_limit + margin_count * _PYOS_STACK_MARGIN_BYTES) {
349+
if (here_addr > _tstate->c_stack_soft_limit + margin_count * _PyOS_STACK_MARGIN_BYTES) {
350350
return 0;
351351
}
352352
if (_tstate->c_stack_hard_limit == 0) {
353353
_Py_InitializeRecursionLimits(tstate);
354354
}
355-
return here_addr <= _tstate->c_stack_soft_limit + margin_count * _PYOS_STACK_MARGIN_BYTES;
355+
return here_addr <= _tstate->c_stack_soft_limit + margin_count * _PyOS_STACK_MARGIN_BYTES;
356356
}
357357

358358
void
@@ -448,8 +448,8 @@ _Py_InitializeRecursionLimits(PyThreadState *tstate)
448448
_tstate->c_stack_top = (uintptr_t)high;
449449
ULONG guarantee = 0;
450450
SetThreadStackGuarantee(&guarantee);
451-
_tstate->c_stack_hard_limit = ((uintptr_t)low) + guarantee + _PYOS_STACK_MARGIN_BYTES;
452-
_tstate->c_stack_soft_limit = _tstate->c_stack_hard_limit + _PYOS_STACK_MARGIN_BYTES;
451+
_tstate->c_stack_hard_limit = ((uintptr_t)low) + guarantee + _PyOS_STACK_MARGIN_BYTES;
452+
_tstate->c_stack_soft_limit = _tstate->c_stack_hard_limit + _PyOS_STACK_MARGIN_BYTES;
453453
#else
454454
uintptr_t here_addr = _Py_get_machine_stack_pointer();
455455
# if defined(HAVE_PTHREAD_GETATTR_NP) && !defined(_AIX) && !defined(__NetBSD__)
@@ -469,17 +469,17 @@ _Py_InitializeRecursionLimits(PyThreadState *tstate)
469469
// Thread sanitizer crashes if we use a bit more than half the stack.
470470
_tstate->c_stack_soft_limit = base + (stack_size / 2);
471471
#else
472-
_tstate->c_stack_soft_limit = base + _PYOS_STACK_MARGIN_BYTES * 2;
472+
_tstate->c_stack_soft_limit = base + _PyOS_STACK_MARGIN_BYTES * 2;
473473
#endif
474-
_tstate->c_stack_hard_limit = base + _PYOS_STACK_MARGIN_BYTES;
474+
_tstate->c_stack_hard_limit = base + _PyOS_STACK_MARGIN_BYTES;
475475
assert(_tstate->c_stack_soft_limit < here_addr);
476476
assert(here_addr < _tstate->c_stack_top);
477477
return;
478478
}
479479
# endif
480480
_tstate->c_stack_top = _Py_SIZE_ROUND_UP(here_addr, 4096);
481481
_tstate->c_stack_soft_limit = _tstate->c_stack_top - Py_C_STACK_SIZE;
482-
_tstate->c_stack_hard_limit = _tstate->c_stack_top - (Py_C_STACK_SIZE + _PYOS_STACK_MARGIN_BYTES);
482+
_tstate->c_stack_hard_limit = _tstate->c_stack_top - (Py_C_STACK_SIZE + _PyOS_STACK_MARGIN_BYTES);
483483
#endif
484484
}
485485

0 commit comments

Comments
 (0)