Skip to content

Conversation

@serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Jun 23, 2020

@zooba
Copy link
Member

zooba commented Jun 23, 2020

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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().

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@serhiy-storchaka serhiy-storchaka merged commit 6c6810d into python:master Jun 24, 2020
@miss-islington
Copy link
Contributor

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8, 3.9.
🐍🍒⛏🤖

@serhiy-storchaka serhiy-storchaka deleted the audit-locale-encoding branch June 24, 2020 05:46
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 24, 2020
@bedevere-bot
Copy link

GH-21107 is a backport of this pull request to the 3.9 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 24, 2020
@bedevere-bot
Copy link

GH-21108 is a backport of this pull request to the 3.8 branch.

@miss-islington
Copy link
Contributor

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 24, 2020
@bedevere-bot
Copy link

GH-21120 is a backport of this pull request to the 3.9 branch.

@bedevere-bot
Copy link

GH-21121 is a backport of this pull request to the 3.8 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 24, 2020
miss-islington added a commit that referenced this pull request Jun 24, 2020
(cherry picked from commit 6c6810d)

Co-authored-by: Serhiy Storchaka <[email protected]>
miss-islington added a commit that referenced this pull request Jun 24, 2020
(cherry picked from commit 6c6810d)

Co-authored-by: Serhiy Storchaka <[email protected]>
fasih pushed a commit to fasih/cpython that referenced this pull request Jun 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants