[issue43299] pyclbr.readmodule_ex traversing "import __main__": dies with ValueError: __main__.__spec__ is None / is not set

2021-07-12 Thread Andrei Kulakov
Andrei Kulakov added the comment: Upon further pondering, I'm not sure PyWin is doing the right thing here. I believe it's best to first file it with PyWin and find out what it is trying to do and why. Pyclbr behavior sort of makes sense to me -- pyclbr goal is to parse and browse the

[issue43299] pyclbr.readmodule_ex traversing "import __main__": dies with ValueError: __main__.__spec__ is None / is not set

2021-07-12 Thread Andrei Kulakov
Andrei Kulakov added the comment: Actually, I was mistaken about this, `readmodule_ex` can get the __main__ from sys.modules.. I will look more into this later today. -- ___ Python tracker

[issue43299] pyclbr.readmodule_ex traversing "import __main__": dies with ValueError: __main__.__spec__ is None / is not set

2021-07-11 Thread Andrei Kulakov
Andrei Kulakov added the comment: (Also if they are able to help, please report back here and update this issue, that will be much appreciated!) -- ___ Python tracker ___

[issue43299] pyclbr.readmodule_ex traversing "import __main__": dies with ValueError: __main__.__spec__ is None / is not set

2021-07-11 Thread Andrei Kulakov
Andrei Kulakov added the comment: Robert: thanks for the response.. I looked a bit more into it and I'm starting to think it's a PyWin issue, not pyclbr. It seems to me that PyWin is calling pyclbr readmodule_ex with module='__main__', and pyclbr is supposed to find it on the filesystem.

[issue43299] pyclbr.readmodule_ex traversing "import __main__": dies with ValueError: __main__.__spec__ is None / is not set

2021-07-10 Thread Robert
Robert added the comment: You see the usecase from the stack trace: PythonWin (the IDE from pywin32 package) uses pyclbr - to inspect arbitrary user code. (Neither code is from me) I'm not inspecting __main__ explicitely. The problem seems to arise in newer Python versions (3.10+?)

[issue43299] pyclbr.readmodule_ex traversing "import __main__": dies with ValueError: __main__.__spec__ is None / is not set

2021-07-06 Thread Andrei Kulakov
Andrei Kulakov 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

[issue43299] pyclbr.readmodule_ex traversing "import __main__": dies with ValueError: __main__.__spec__ is None / is not set

2021-07-06 Thread Andrei Kulakov
Change by Andrei Kulakov : -- type: crash -> behavior ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43299] pyclbr.readmodule_ex traversing "import __main__": dies with ValueError: __main__.__spec__ is None / is not set

2021-02-22 Thread Robert
Change by Robert : -- keywords: +patch pull_requests: +23407 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24623 ___ Python tracker ___

[issue43299] pyclbr.readmodule_ex traversing "import __main__": dies with ValueError: __main__.__spec__ is None / is not set

2021-02-22 Thread Robert
New submission from Robert : When pyclbr.readmodule_ex() is traversing "import __main__" or another module without __spec__, it dies completely with "ValueError: __main__.__spec__ is None / is not set". => It should at least continue with the (big) rest as the comment in