diff options
author | Petr Viktorin <encukou@gmail.com> | 2023-05-04 09:56:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-04 09:56:53 +0200 |
commit | cd9a56c2b0e14f56f2e83dd4db43c5c69a74b232 (patch) | |
tree | ff971ebbdb11701bab003d743a6d5b928c35184f /Python | |
parent | 35d273825abc319d0ecbd69110e847f6040d0cd7 (diff) | |
download | cpython-git-cd9a56c2b0e14f56f2e83dd4db43c5c69a74b232.tar.gz |
gh-103509: PEP 697 -- Limited C API for Extending Opaque Types (GH-103511)
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Diffstat (limited to 'Python')
-rw-r--r-- | Python/structmember.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Python/structmember.c b/Python/structmember.c index 1b8be28dcf..19a75224a0 100644 --- a/Python/structmember.c +++ b/Python/structmember.c @@ -8,6 +8,12 @@ PyObject * PyMember_GetOne(const char *obj_addr, PyMemberDef *l) { PyObject *v; + if (l->flags & Py_RELATIVE_OFFSET) { + PyErr_SetString( + PyExc_SystemError, + "PyMember_GetOne used with Py_RELATIVE_OFFSET"); + return NULL; + } const char* addr = obj_addr + l->offset; switch (l->type) { @@ -103,6 +109,12 @@ int PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) { PyObject *oldv; + if (l->flags & Py_RELATIVE_OFFSET) { + PyErr_SetString( + PyExc_SystemError, + "PyMember_SetOne used with Py_RELATIVE_OFFSET"); + return -1; + } addr += l->offset; |