bpo-41094: Fix decoding errors with audit when open files.#21095
Conversation
|
I have no idea what the ossaudiodev failure relates to... that doesn't go through this code path does it? |
|
|
||
| if (gil_held) { | ||
| if (PySys_Audit("open", "sOi", pathname, Py_None, flags) < 0) { | ||
| PyObject *pathname_obj = PyUnicode_DecodeFSDefault(pathname); |
There was a problem hiding this comment.
Would it be possible to call should_audit() here to avoid decoding the string if audit is disabled?
Something like:
if (should_audit()) {
pathname_obj = PyUnicode_DecodeFSDefault(pathname);
PySys_Audit(pathname_obj)
Py_DECREF(pathname_obj);
}
Same remark for _Py_fopen().
There was a problem hiding this comment.
This is not performance critical, and should_audit() is not available in Python/fileutils.c, so this needs additional work. I prefer to merge simple fix. You can add the call should_audit() in separate PR.
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8, 3.9. |
|
GH-21107 is a backport of this pull request to the 3.9 branch. |
|
GH-21108 is a backport of this pull request to the 3.8 branch. |
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9. |
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8. |
|
GH-21120 is a backport of this pull request to the 3.9 branch. |
|
GH-21121 is a backport of this pull request to the 3.8 branch. |
https://bugs.python.org/issue41094