Hi,
Yes, it is partly due to optimization. Before return a 32bit sal_Int32 into 64bit Py_ssize_t, the high 32bit of a 64bit register should be set to zeros. In -O2, compiler doesn't clean these bits. But I cannot reproduce it with a simpler case.
And this might relates to bridge implementation. PyUNO_len() calls lcl_detach_getLength() to get count though bridge. Maybe high 32 bit of the returned register should be cleaned in bridge.
Probably. I don't know what the other archs do, they don't exhibit this problem even though also being 64bit so something has to be done by them to get it right?
So I guess I'll workaround this by building with -O0. (riscv64 isn't alone there, seeThanks! Is there any way to build just 'pyuno' module with -O0?https://salsa.debian.org/libreoffice-team/libreoffice/libreoffice/-/blob/master/rules#L746 (upto line 771)
maybe make ENABLE_OPTIMIZED= inside pyuno (just from looking at the makefiles.. But that won't give you a package. (unless you copy the changed files over)
Regards,
Rene