diff options
author | Petr Viktorin <encukou@gmail.com> | 2021-01-12 14:45:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-12 14:45:05 (GMT) |
commit | 187f76def8a5bd0af7ab512575cad30cfe624b05 (patch) | |
tree | db9ccc652ff67efda727de984dfd07e605104152 /Include/cpython | |
parent | 5ded7efa6a7a232dd4a41e6e65e4dae47146514b (diff) | |
download | cpython-187f76def8a5bd0af7ab512575cad30cfe624b05.zip cpython-187f76def8a5bd0af7ab512575cad30cfe624b05.tar.gz cpython-187f76def8a5bd0af7ab512575cad30cfe624b05.tar.bz2 |
[3.8] bpo-40052: Fix alignment issue in PyVectorcall_Function() (GH-23999) (GH-24120)
Co-Authored-By: Andreas Schneider <asn@cryptomilk.org>
Co-Authored-By: Antoine Pitrou <antoine@python.org>.
Co-authored-by: Petr Viktorin <encukou@gmail.com>
(cherry picked from commit 056c08211b402b4dbc1530a9de9d00ad5309909f)
https://bugs.python.org/issue40052
Diffstat (limited to 'Include/cpython')
-rw-r--r-- | Include/cpython/abstract.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Include/cpython/abstract.h b/Include/cpython/abstract.h index 2ea3209..dbfce2d 100644 --- a/Include/cpython/abstract.h +++ b/Include/cpython/abstract.h @@ -82,14 +82,14 @@ _PyVectorcall_Function(PyObject *callable) { PyTypeObject *tp = Py_TYPE(callable); Py_ssize_t offset = tp->tp_vectorcall_offset; - vectorcallfunc *ptr; + vectorcallfunc ptr; if (!PyType_HasFeature(tp, _Py_TPFLAGS_HAVE_VECTORCALL)) { return NULL; } assert(PyCallable_Check(callable)); assert(offset > 0); - ptr = (vectorcallfunc*)(((char *)callable) + offset); - return *ptr; + memcpy(&ptr, (char *) callable + offset, sizeof(ptr)); + return ptr; } /* Call the callable object 'callable' with the "vectorcall" calling |