Andrei Kulakov <andrei....@gmail.com> added the comment:

Robert: I haven't worked with importlib or pyclbr before, so these may be naive 
questions, but:

- can your usecase be resolved with a workaround, e.g. setting ModuleSpec 
manually in / on __main__ module, something like `from importlib._bootstrap 
import ModuleSpec; __spec__ = ModuleSpec('main',None)

- You mention that this issue may apply to other modules, but the Python docs 
say __main__ is the only case that may have __spec__=None in some cases (in my 
testing it indeed have it set to None). Do you have any examples where other 
modules have __spec__=None?

What's your usecase for examining __main__ with pyclbr? Not trying to sound 
doubtful, just really curious.

- Re your PR I have a bit of a concern that catching a ValueError silently 
might mask other types of ValueError, but I haven't looked more closely into 
that, just want to note it here for the future.

Btw thanks for the reply on PR to my question, it makes sense.

----------
nosy: +andrei.avk

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

Reply via email to