Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

DocTest sorts by lineno which may be int or None #94722

Closed
Labels
stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error
@Strilanc

Description

@Strilanc

Indoctest.py the following ordering is defined for the classDocTest:

    def __lt__(self, other):        if not isinstance(other, DocTest):            return NotImplemented        return ((self.name, self.filename, self.lineno, id(self))                <                (other.name, other.filename, other.lineno, id(other)))

This is incorrect because thelineno field may be an integer and may be None, and comparisons between integers and None fail. Typicallylineno is an integer, but_find_lineno explicitly can fall back to returningNone so the field may be None:

    def _find_lineno(self, obj, source_lines):        ...        # We couldn't find the line number.        return None

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp