Hi Luca, On Fri, 24 Dec 2021 at 03:38, Luca Weiss <luca@xxxxxxxxx> wrote: > > Fatal Python error: none_dealloc: deallocating None > Python runtime state: finalizing (tstate=0x000055c9bac70920) > > Current thread 0x00007fbe34e47740 (most recent call first): > <no Python frame> > Aborted (core dumped) > > This is caused by a missing Py_INCREF on the returned Py_None, as > demonstrated e.g. in https://github.com/mythosil/swig-python-incref or > described at https://edcjones.tripod.com/refcount.html ("Remember to > INCREF Py_None!") > > A PoC for triggering this crash is uploaded to > https://github.com/z3ntu/pylibfdt-crash . > With this patch applied to pylibfdt the crash does not happen. > > Signed-off-by: Luca Weiss <luca@xxxxxxxxx> > --- > Unrelated but I've noticed that in this file the indentation is quite > mixed between spaces and tabs. This patch tries to keep to the style in > the lines around. > > pylibfdt/libfdt.i | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) Reviewed-by: Simon Glass <sjg@xxxxxxxxxxxx> My original idea was to use tabs for the C code (to match the libfdt style) and spaces for the Python code (for PEP8). Looking at it now, that idea has not continued and I'm not even sure it was a good idea. Regards, Simon