File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 5
5
import sys
6
6
import _thread
7
7
8
+ # Check if we need a larger stack for sanitizer builds
9
+ def needs_big_stack ():
10
+ try :
11
+ import os
12
+ # Unix/Windows with potential sanitizer builds
13
+ if hasattr (os , "name" ) and os .name in ("posix" , "nt" ):
14
+ # Check for sanitizer environment variables (used in CI)
15
+ if hasattr (os , "environ" ):
16
+ return any (k in os .environ for k in ("UBSAN_OPTIONS" , "ASAN_OPTIONS" ))
17
+ # Emscripten/WebAssembly builds
18
+ if hasattr (sys , "platform" ) and sys .platform == "emscripten" :
19
+ return True
20
+ except :
21
+ pass
22
+ return False
23
+
8
24
# different implementations have different minimum sizes
9
25
if sys .implementation .name == "micropython" :
10
- sz = 2 * 1024
26
+ # Sanitizer builds need larger stack (32KB) due to extra margins
27
+ # MCU and normal builds can use smaller stack (2KB)
28
+ sz = 32 * 1024 if needs_big_stack () else 2 * 1024
11
29
else :
12
30
sz = 512 * 1024
13
31
You can’t perform that action at this time.
0 commit comments