This fixes the ctypes.test.test_structures.StructureTestCase test.
https://bugs.python.org/issue35847
(cherry picked from commit
742d768656512a469ce9571b1cbd777def7bc5ea)
Co-authored-by: Andreas Schwab <schwab@linux-m68k.org>
--- /dev/null
+RISC-V needed the CTYPES_PASS_BY_REF_HACK. Fixes ctypes Structure test_pass_by_value.
#endif
#if (defined(__x86_64__) && (defined(__MINGW64__) || defined(__CYGWIN__))) || \
- defined(__aarch64__)
+ defined(__aarch64__) || defined(__riscv)
#define CTYPES_PASS_BY_REF_HACK
#define POW2(x) (((x & ~(x - 1)) == x) ? x : 0)
#define IS_PASS_BY_REF(x) (x > 8 || !POW2(x))