esp32/mphalport: Print debug strings even before the GIL is ready.
If verbose debugging is enabled there is some stdout output happening
before the GIL is ready (for example, GC initialisation), and the code
assumed that no string printing occurred before the interpreter was fully
initialised. Printing long strings would operate without holding the GIL,
which would crash if string output would happen too early in the startup
process.
This commit addresses that issue, making sure verbose debugging output will
work even before the interpreter is fully initialised (as if it is not yet
ready there's no GIL to take care of).
Also, the threshold that would indicate whether a string is "long" (and
thus requiring a GIL release/lock operation) or not was hardcoded to 20
bytes. This commit makes that configurable, maintaining 20 bytes as a
default.
Fixes issue #15408.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Showing
Please register or sign in to comment