Skip to content

Commit

Permalink
bpo-35847: RISC-V needs CTYPES_PASS_BY_REF_HACK (pythonGH-11694)
Browse files Browse the repository at this point in the history
This fixes the ctypes.test.test_structures.StructureTestCase test.

https://bugs.python.org/issue35847
(cherry picked from commit 742d768)

Co-authored-by: Andreas Schwab <schwab@linux-m68k.org>
  • Loading branch information
miss-islington and andreas-schwab committed Jan 29, 2019
1 parent ff27f81 commit 10354cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
RISC-V needed the CTYPES_PASS_BY_REF_HACK. Fixes ctypes Structure test_pass_by_value.
2 changes: 1 addition & 1 deletion Modules/_ctypes/callproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@ GetComError(HRESULT errcode, GUID *riid, IUnknown *pIunk)
#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))
Expand Down

0 comments on commit 10354cb

Please sign in to comment.