New submission from Cyker Way <cyker...@gmail.com>:

The current implementation of `pkgutil.walk_packages()` is confusing. Users may 
be given incomplete results while no exception is raised if they don't 
explicitly provide the `prefix` parameter. The doc says:

>   prefix is a string to output on the front of every module name on output.

But the fact is, `prefix` is not merely an output formatter at all. This 
function cannot handle an empty prefix (which is the default) and will often 
encounter import errors which are then simply ignored without an `onerror` 
function (which is default again).

See test program for details.

Doc:

https://docs.python.org/3.6/library/pkgutil.html#pkgutil.walk_packages

Source:

https://github.com/python/cpython/blob/3.6/Lib/pkgutil.py

----------
components: Library (Lib)
files: test.py
messages: 314850
nosy: cykerway
priority: normal
severity: normal
status: open
title: pkgutil.walk_packages gives incomplete results
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47516/test.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33210>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to