GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `Audit events table` doc section is generated with broken links · Issue #93857 · python/cpython

Audit events table doc section is generated with broken links #93857

New issue
Copy link
New issue
Copy link
Closed
#93859
Closed
Audit events table doc section is generated with broken links#93857
#93859
Copy link
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@arhadthedev
arhadthedev
opened on Jun 15, 2022
Issue body actions

Parent issue: gh-93851

https://docs.python.org/3/library/audit_events.html has two links to non-existent sections of sqlite3.html:

  • sqlite3.enable_load_extension | connection, enabled | [1]
  • sqlite3.load_extension | connection, path | [1]

I couldn't find where these lines come from. A source file https://github.com/python/cpython/blob/ff095e13dfdea64de5c1ad21021ae9b5ca2631f8/Doc/library/audit_events.rst is much shorter, and I don't know what to grep.

Activity

  1. arhadthedev
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Jun 15, 2022
  2. AlexWaygood
    added
    topic-sqlite3
    on Jun 15, 2022
  3. AlexWaygood
    assigned
    erlend-aasland
    on Jun 15, 2022
  4. erlend-aasland commented on Jun 15, 2022

    @erlend-aasland
    erlend-aasland
    on Jun 15, 2022
    Contributor
    More actions

    https://docs.python.org/3/library/audit_events.html has two links to non-existent sections of sqlite3.html:

    • sqlite3.enable_load_extension | connection, enabled | [1]
    • sqlite3.load_extension | connection, path | [1]

    They are not non-existent, they just live under the sqlite3.Connection namespace. The audit names, however, are sqlite3.enable_load_extension and sqlite3.load_extension.

    I couldn't find where these lines come from. A source file https://github.com/python/cpython/blob/ff095e13dfdea64de5c1ad21021ae9b5ca2631f8/Doc/library/audit_events.rst is much shorter, and I don't know what to grep.

    That file is partly autogenerated, as noted on line 17.

    This table is generated from the CPython documentation [...]

    I suspect we need to alter the audit-event Sphinx extension to fix these things:

    cpython/Doc/tools/extensions/pyspecific.py

    Lines 189 to 278 in ff095e1

    class AuditEvent(Directive):
    has_content = True
    required_arguments = 1
    optional_arguments = 2
    final_argument_whitespace = True
    _label = [
    "Raises an :ref:`auditing event <auditing>` {name} with no arguments.",
    "Raises an :ref:`auditing event <auditing>` {name} with argument {args}.",
    "Raises an :ref:`auditing event <auditing>` {name} with arguments {args}.",
    ]
    @property
    def logger(self):
    cls = type(self)
    return logging.getLogger(cls.__module__ + "." + cls.__name__)
    def run(self):
    name = self.arguments[0]
    if len(self.arguments) >= 2 and self.arguments[1]:
    args = (a.strip() for a in self.arguments[1].strip("'\"").split(","))
    args = [a for a in args if a]
    else:
    args = []
    label = translators['sphinx'].gettext(self._label[min(2, len(args))])
    text = label.format(name="``{}``".format(name),
    args=", ".join("``{}``".format(a) for a in args if a))
    env = self.state.document.settings.env
    if not hasattr(env, 'all_audit_events'):
    env.all_audit_events = {}
    new_info = {
    'source': [],
    'args': args
    }
    info = env.all_audit_events.setdefault(name, new_info)
    if info is not new_info:
    if not self._do_args_match(info['args'], new_info['args']):
    self.logger.warn(
    "Mismatched arguments for audit-event {}: {!r} != {!r}"
    .format(name, info['args'], new_info['args'])
    )
    ids = []
    try:
    target = self.arguments[2].strip("\"'")
    except (IndexError, TypeError):
    target = None
    if not target:
    target = "audit_event_{}_{}".format(
    re.sub(r'\W', '_', name),
    len(info['source']),
    )
    ids.append(target)
    info['source'].append((env.docname, target))
    pnode = nodes.paragraph(text, classes=["audit-hook"], ids=ids)
    pnode.line = self.lineno
    if self.content:
    self.state.nested_parse(self.content, self.content_offset, pnode)
    else:
    n, m = self.state.inline_text(text, self.lineno)
    pnode.extend(n + m)
    return [pnode]
    # This list of sets are allowable synonyms for event argument names.
    # If two names are in the same set, they are treated as equal for the
    # purposes of warning. This won't help if number of arguments is
    # different!
    _SYNONYMS = [
    {"file", "path", "fd"},
    ]
    def _do_args_match(self, args1, args2):
    if args1 == args2:
    return True
    if len(args1) != len(args2):
    return False
    for a1, a2 in zip(args1, args2):
    if a1 == a2:
    continue
    if any(a1 in s and a2 in s for s in self._SYNONYMS):
    continue
    return False
    return True

  5. erlend-aasland
    added
    docsDocumentation in the Doc dirDocumentation in the Doc dir
    and removed
    topic-sqlite3
    on Jun 15, 2022
  6. erlend-aasland
    removed their assignment
    on Jun 15, 2022
  7. erlend-aasland commented on Jun 15, 2022

    @erlend-aasland
    erlend-aasland
    on Jun 15, 2022
    Contributor
    More actions

    [...] I don't know what to grep.

    $ grep -r "audit-event::" Doc/
    $ grep -r "audit-event::.*sqlite" Doc/
  8. erlend-aasland commented on Jun 15, 2022

    @erlend-aasland
    erlend-aasland
    on Jun 15, 2022
    Contributor
    More actions

    I suspect we need to alter the audit-event Sphinx extension to fix these things [...]

    Or maybe we're using the audit-event directive wrongly in Doc/library/sqlite3.rst.

  9. erlend-aasland commented on Jun 15, 2022

    @erlend-aasland
    erlend-aasland
    on Jun 15, 2022
    Contributor
    More actions

    Yay, it was the latter. So we don't need to dig around in the Python Sphinx extensions (phew!) :)

    Reacted by Alex Waygood
  10. erlend-aasland
    added a commit that references this issue on Jun 15, 2022

    pythongh-93857: Fix broken audit-event targets in sqlite3 docs

    a347a0d
  11. erlend-aasland
    linked a pull request that will close this issuegh-93857: Fix broken audit-event targets in sqlite3 docs #93859on Jun 15, 2022
  12. erlend-aasland
    added this to sqlite3 issueson Jun 15, 2022
  13. erlend-aasland
    moved this to In Progress in sqlite3 issueson Jun 15, 2022
  14. erlend-aasland commented on Jun 15, 2022

    @erlend-aasland
    erlend-aasland
    on Jun 15, 2022
    Contributor
    More actions

    FTR, the third argument to the audit-event directive is the target:

    cpython/Doc/tools/extensions/pyspecific.py

    Lines 236 to 243 in ff095e1

    try:
    target = self.arguments[2].strip("\"'")
    except (IndexError, TypeError):
    target = None
    if not target:
    target = "audit_event_{}_{}".format(
    re.sub(r'\W', '_', name),
    len(info['source']),

  15. erlend-aasland
    closed this as completedin #93859on Jun 15, 2022
  16. Repository owner moved this from In Progress to Done in sqlite3 issueson Jun 15, 2022
  17. miss-islington
    added a commit that references this issue on Jun 15, 2022

    pythongh-93857: Fix broken audit-event targets in sqlite3 docs (pytho…

    1a2de8d
  18. erlend-aasland
    added a commit that references this issue on Jun 15, 2022

    gh-93857: Fix broken audit-event targets in sqlite3 docs (#93859)

    ce4d11f
  19. miss-islington
    added a commit that references this issue on Jun 15, 2022

    pythongh-93857: Fix broken audit-event targets in sqlite3 docs (pytho…

    5e0affb
  20. erlend-aasland commented on Jun 15, 2022

    @erlend-aasland
    erlend-aasland
    on Jun 15, 2022
    Contributor
    More actions

    Fixed in:

    • main: gh-93857: Fix broken audit-event targets in sqlite3 docs #93859
    • 3.11: [3.11] gh-93857: Fix broken audit-event targets in sqlite3 docs (GH-93859) #93861
    • 3.10: [3.10] gh-93857: Fix broken audit-event targets in sqlite3 docs (GH-93859) #93862
  21. miss-islington
    added 2 commits that reference this issue on Jun 15, 2022

    gh-93857: Fix broken audit-event targets in sqlite3 docs (GH-93859)

    40c257d

    gh-93857: Fix broken audit-event targets in sqlite3 docs (GH-93859)

    e929dae
  22. serhiy-storchaka
    added a commit that references this issue on Jun 26, 2022

    Revert 30935 defer bpo45162 to 312 (#94285)

    1ffde3e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirDocumentation in the Doc dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    • sqlite3 issues
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.