[Python-checkins] bpo-35847: RISC-V needs CTYPES_PASS_BY_REF_HACK (GH-11694)
Miss Islington (bot)
webhook-mailer at python.org
Tue Jan 29 16:11:41 EST 2019
https://github.com/python/cpython/commit/10354cbb5067b4719ba1c2d51d22314a644ed3e5
commit: 10354cbb5067b4719ba1c2d51d22314a644ed3e5
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-01-29T13:11:36-08:00
summary:
bpo-35847: RISC-V needs CTYPES_PASS_BY_REF_HACK (GH-11694)
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 at linux-m68k.org>
files:
A Misc/NEWS.d/next/Library/2019-01-29-09-11-09.bpo-35847.eiSi4t.rst
M Modules/_ctypes/callproc.c
diff --git a/Misc/NEWS.d/next/Library/2019-01-29-09-11-09.bpo-35847.eiSi4t.rst b/Misc/NEWS.d/next/Library/2019-01-29-09-11-09.bpo-35847.eiSi4t.rst
new file mode 100644
index 000000000000..e3775f96f36e
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-01-29-09-11-09.bpo-35847.eiSi4t.rst
@@ -0,0 +1 @@
+RISC-V needed the CTYPES_PASS_BY_REF_HACK. Fixes ctypes Structure test_pass_by_value.
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index ec596b4de31d..e971388f69b9 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -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))
More information about the Python-checkins
mailing list