pydoc.ispackage() is a best-effort guess at whether or not a path is the location of a package. However, it uses hard-coded suffixes when matching file names, which can miss files (e.g. extension modules and sourceless packages on Windows). It should probably use suffixes defined in importlib.util, as they're used elsewhere in pydoc. The function also does not comprehend namespace packages, but I'm not sure that's worth worrying about. FWIW, it isn't clear to me what is using pydoc.ispackage(). It may not be used in the stdlib at all.
It was used by pydoc.py until 2006, when it was removed with this commit: Changeset: 37821 (3135648026c4) Second phase of refactoring for runpy, pkgutil, pydoc, and setuptools. Is it worth to fix this?