[issue38622] _ctypes.dlsym (py_dl_sym) does not trigger audit hooks

Steve Dower report at bugs.python.org
Mon Nov 18 14:47:25 EST 2019


Steve Dower <steve.dower at python.org> added the comment:

Typically, as soon as I merge, I spot an edge case issue.

PySys_Audit(n, "O", a) is deliberately going to treat 'a' as the tuple of arguments (when it is a tuple). This lets us simplify/optimise events where the event arguments match the function arguments exactly. If 'a' is not a tuple, it gets wrapped in one.

When 'a' is meant to be a single argument that _might_ be a tuple, such as in PyObj_FromPtr, the format string needs to be "(O)" to ensure it is treated as a one element tuple. This is just how Py_BuildValue works - multiple elements become a tuple and the parens are optional unless you want a one-element tuple.

----------

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


More information about the Python-bugs-list mailing list