• Alessandro Gatti's avatar
    esp32/mphalport: Print debug strings even before the GIL is ready. · 0b75e180
    Alessandro Gatti authored
    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: default avatarAlessandro Gatti <a.gatti@frob.it>
    0b75e180
mphalport.c 7.85 KB