Skip to content

Commit 7b773d3

Browse files
committed
Adjust comments
1 parent ae6d786 commit 7b773d3

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎Python/ceval.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,15 @@ hardware_stack_limits(uintptr_t *base, uintptr_t *top, uintptr_t sp)
123123
# ifdef _Py_HAVE_UNRELIABLE_PTHREAD_GETATTR_NP
124124
/* pthread_getattr_np on the main thread of a musl process reports
125125
* only the part of the stack that is currently mapped, rather than
126-
* the size allowed. The top is correct. Extend the stack downwards
127-
* from it, by the current RLIMIT_STACK or the compile-time guess,
128-
* Py_C_STACK_SIZE.
126+
* the size allowed. The reported top is correct.
129127
* New threads are reported correctly even on musl, so this fallback
130128
* only applies to the main thread. */
131129
if ((pid_t)syscall(SYS_gettid) == getpid()) {
132130
struct rlimit rl;
133131
if (getrlimit(RLIMIT_STACK, &rl) == 0) {
132+
/* If there's a reasonable limit set (one that fits in the
133+
* address space below *top), use that.
134+
* Otherwise use the compile-time guess */
134135
size_t limit = Py_C_STACK_SIZE;
135136
if (rl.rlim_cur != RLIM_INFINITY && rl.rlim_cur < *top) {
136137
limit = (size_t)rl.rlim_cur;

0 commit comments

Comments
 (0)