Skip to content

Remove unused __linecnt attribute from _sitebuiltins #150427

@angelolicastro

Description

@angelolicastro

_sitebuiltins._Printer.__setup creates an instance attribute, __linecnt, which is unused:

cpython % git grep __linecnt
Lib/_sitebuiltins.py:        self.__linecnt = len(self.__lines)

This could be used by _sitebuiltins._Printer.__repr__ in lieu of len(self.__lines):

        self.__setup()
        if len(self.__lines) <= self.MAXLINES:
            return "\n".join(self.__lines)

But because len(self.__lines) is only referenced as such, we can remove __linecnt instead.

This was introduced in d125239 but also unused then.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-refactorCode refactoring (with no changes in behavior)
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions