Jacek Kołodziej added the comment:

> In any case it is too late for 3.5.

Ok, next round of patches is based on default branch.

> Jacek: If we used the ModuleType check, and somebody adds a module-level 
> constant (like logging.CRITICAL = 50), the test will automatically detect if 
> they forget to update __all__. That is what I meant by the test being 
> stricter.

Right and I think such case should be covered as well. I think it may be worth 
the hassle of adding new condition in detecting names expected to be 
documented, so the whole if clause would look like:

if (getattr(module_object, '__module__', None) in name_of_module
        or (not isinstance(module_object, types.ModuleType)
            and not hasattr(module_object, '__module__'))):
    expected.add(name)

Obviously tradeoff lies in required blacklisting:
* with previous __module__ check - all undocumented, non "_*" names defined in 
checked module, but constants need to be in *extra* and new ones won't be 
detected
* with ModuleType check only - all undocumented, non "_*" names defined in 
checked module + all functions and classes imported from other modules needs 
blacklisting
* with extended __module__ check (proposed above) - all undocumented, non "_*" 
names defined in checked module + all constants imported from other modules; 
this choice also requires less 'extra' params (in fact, in these patches only 
csv.__doc/version__ case left)

In this round of patches I went the new, third way.

One odd thing: in test.test_logging, are these:

3783:        self.addCleanup(setattr, logging, 'raiseExecptions', old_raise)
3790:        self.addCleanup(setattr, logging, 'raiseExecptions', old_raise)

("Ex*ec*ptions") really typos or is it intentional? test.test_logging has 
raiseExceptions name as well.

Also, pickletools.OpcodeInfo and threading.ThreadError are not really 
documented, are they?

----------
Added file: http://bugs.python.org/file39869/Issue23883_all.v4.patch

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

Reply via email to