Skip to content

Argument Clinic does not check the length of parameter descriptions #155228

Description

@serhiy-storchaka

Bug report

The docstring line length check is performed before the parameter descriptions are added to the docstring:

        max_width = f.docstring_line_width
        summary_len = len(lines[0])
        max_body = max(map(len, lines[1:]))
        ...
        if not parameters_marker_count:
            lines.insert(2, '{parameters}')

So a description of any length is accepted without a warning.

24 functions in the current tree have parameter description lines longer than the limit (the number of too long lines is in parentheses):

  • _lzma.LZMADecompressor (4)
  • select.epoll (3)
  • int.to_bytes (2)
  • select.kqueue.control (2)
  • str.encode (2)
  • winreg.SetValueEx (2)
  • _sqlite3.Connection.getconfig
  • _sqlite3.Connection.setconfig
  • _sre.template
  • _winapi.RegisterEventSource
  • _zstd.ZstdCompressor.set_pledged_input_size
  • bytearray.decode
  • bytearray.rsplit
  • bytearray.split
  • bytearray.take_bytes
  • bytes.decode
  • bytes.rsplit
  • bytes.split
  • gc.set_debug
  • os.timerfd_create
  • select.poll.poll
  • winreg.ConnectRegistry
  • winreg.DeleteTree
  • zlib._ZlibDecompressor

This is easy to miss for a cloned function, which inherits the descriptions of the function it clones: bytes.split and bytes.rsplit (and the bytearray pair) both have a 69 character line, and rewrapping the description in bytes.split does not make Argument Clinic report anything for either of them.

This is a leftover of #150285.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.16new features, bugs and security fixestopic-argument-clinictype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions