Skip to content

bpo-41192: Clarify the sys module's description of the auditing feature #22768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 20, 2020

Conversation

akuchling
Copy link
Contributor

@akuchling akuchling commented Oct 19, 2020

While looking at another PR for this ticket, I learned about 3.8's new auditing feature but found the sys module docs to be rather cryptic. This PR adds some text from the original PEP, adds a link to the PEP, and does some rewriting for clarity. I think the two functions now sufficiently explain what the auditing feature is for & how to use it.

https://bugs.python.org/issue41192

Copy link
Member

@terryjreedy terryjreedy left a comment

Choose a reason for hiding this comment

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

Overall, an improvement that I believe is correct.

In general, any exceptions raised by this function should not be
handled and should terminate the process as quickly as
possible. This allows hook implementations to decide how to respond
to any particular event. The typical responses will be to log the
Copy link
Member

Choose a reason for hiding this comment

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

This sort of duplicates what is said earlier, but probably OK.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's no other section or module to link to, so the body of these two functions is basically going to be it for documentation of this auditing feature, so I'm trying to cover everything, but your point about duplication is good!

I've reduced the discussion of sys.audit() a bit, leaving the hook order unspecified and taking out the PEP link. The bulk of the documentation is now on sys.addaudithook(), which seems like the more complicated function and embodies more of the feature's API.

these errors should not be handled and should terminate the process as
quickly as possible.
Raise an auditing event and trigger any active auditing hooks.
`event` is a string identifying the event, and `args` may contain
Copy link
Member

Choose a reason for hiding this comment

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

Travis does not like the backticks here and on 97. "default role"

Co-authored-by: Éric Araujo <[email protected]>
@akuchling akuchling merged commit 0c37269 into python:master Oct 20, 2020
@miss-islington
Copy link
Contributor

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

@miss-islington
Copy link
Contributor

Sorry @akuchling, I had trouble checking out the 3.9 backport branch.
Please backport using cherry_picker on command line.
cherry_picker 0c37269be7065b9b15b7b3a4406084f9535a793a 3.9

@bedevere-bot
Copy link

GH-22820 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 Oct 20, 2020
…re (pythonGH-22768)

Co-authored-by: Éric Araujo <[email protected]>
(cherry picked from commit 0c37269)

Co-authored-by: Andrew Kuchling <[email protected]>
akuchling added a commit to akuchling/cpython that referenced this pull request Oct 20, 2020
… feature (pythonGH-22768)

Co-authored-by: Éric Araujo <[email protected]>
(cherry picked from commit 0c37269)

Co-authored-by: Andrew Kuchling <[email protected]>
@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Oct 20, 2020
@bedevere-bot
Copy link

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

adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants