[issue33406] [ctypes] increase refcount of a CFUNCTYPE instance when passing to a CDLL

Zuzu_Typ report at bugs.python.org
Wed May 2 02:39:05 EDT 2018


New submission from Zuzu_Typ <zuzu.typ at gmail.com>:

It should be considered to increase the refcount of functions that are passed on to an external library at some point.

If this is not done and e.g. the function was a local variable, when leaving the scope it gets garbage-collected. When the library now tries to execute said function, an access violation occurs.

So if the refcount were increased either upon creating the CFUNCTYPE instance or when it's passed on, this could be avoided.

----------
components: ctypes
messages: 316047
nosy: Zuzu_Typ
priority: normal
severity: normal
status: open
title: [ctypes] increase refcount of a CFUNCTYPE instance when passing to a CDLL
type: behavior

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33406>
_______________________________________


More information about the Python-bugs-list mailing list