diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-08-30 12:30:33 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-30 12:30:33 (GMT) |
commit | 96b4087ce784ee7434dffdf69c475f5b40543982 (patch) | |
tree | ae440df23a43a6bbfd6e6f00d6c353ae3c88dd52 /Misc | |
parent | 6a650aaf7735e30636db2721247f317064c2cfd4 (diff) | |
download | cpython-96b4087ce784ee7434dffdf69c475f5b40543982.zip cpython-96b4087ce784ee7434dffdf69c475f5b40543982.tar.gz cpython-96b4087ce784ee7434dffdf69c475f5b40543982.tar.bz2 |
bpo-37140: Fix StructUnionType_paramfunc() (GH-15612)
Fix a ctypes regression of Python 3.8. When a ctypes.Structure is
passed by copy to a function, ctypes internals created a temporary
object which had the side effect of calling the structure finalizer
(__del__) twice. The Python semantics requires a finalizer to be
called exactly once. Fix ctypes internals to no longer call the
finalizer twice.
Create a new internal StructParam_Type which is only used by
_ctypes_callproc() to call PyMem_Free(ptr) on Py_DECREF(argument).
StructUnionType_paramfunc() creates such object.
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Library/2019-08-30-11-21-10.bpo-37140.cFAX-a.rst | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2019-08-30-11-21-10.bpo-37140.cFAX-a.rst b/Misc/NEWS.d/next/Library/2019-08-30-11-21-10.bpo-37140.cFAX-a.rst new file mode 100644 index 0000000..4eaa226 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-08-30-11-21-10.bpo-37140.cFAX-a.rst @@ -0,0 +1,5 @@ +Fix a ctypes regression of Python 3.8. When a ctypes.Structure is passed by +copy to a function, ctypes internals created a temporary object which had +the side effect of calling the structure finalizer (__del__) twice. The +Python semantics requires a finalizer to be called exactly once. Fix ctypes +internals to no longer call the finalizer twice. |