[issue35791] Unexpected exception with importlib

2019-01-27 Thread Nick Coghlan


Nick Coghlan  added the comment:

#35839 is follow-up enhancement request, proposing that we tweak the 
sys.modules handling in find_spec to ignore cache entries that don't have a 
__spec__ attribute set.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35791] Unexpected exception with importlib

2019-01-22 Thread Eric Snow


Eric Snow  added the comment:

FYI, I opened #35806 for typing.io.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35791] Unexpected exception with importlib

2019-01-22 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

I expected as much. 

I've filed an issue with apipkg for this: 
https://github.com/pytest-dev/apipkg/issues/13. 

My next challenge is to find a way to work around this issue in my code.

BTW. Typing.io is a namespace added to sys.modules by the typing module that 
also does not have __spec__, and causes similar problems. I have an simple 
workaround for that on my side.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35791] Unexpected exception with importlib

2019-01-22 Thread Nick Coghlan


Nick Coghlan  added the comment:

Yep, that's a bug in `py`'s module interface emulation - see the last paragraph 
in https://docs.python.org/3/reference/import.html#module-spec

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35791] Unexpected exception with importlib

2019-01-20 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

This might be a bug in "py", which uses a vendored version of apipkg that 
replaces sys.modules["py"] with a lazy loading object. That copy of apipkg does 
not copy __spec__ into the lazy loading object.

If this is indeed consider to be a bug in py I'll file an issue with them.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35791] Unexpected exception with importlib

2019-01-20 Thread Ronald Oussoren


New submission from Ronald Oussoren :

Using Python 3.7.2 on macOS 10.14 I get an unexpected exception when calling 
"importlib.util.find_spec('py')" after importing "py". find_spec works as 
expected before I import 'py'. 

See the repl session below:

Python 3.7.2 (v3.7.2:9a3ffc0492, Dec 24 2018, 02:44:43) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import importlib.util
>>> importlib.util.find_spec("py")
ModuleSpec(name='py', loader=<_frozen_importlib_external.SourceFileLoader 
object at 0x10a953fd0>, 
origin='/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/py/__init__.py',
 
submodule_search_locations=['/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/py'])
>>> import py
>>> importlib.util.find_spec("py")
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/util.py",
 line 111, in find_spec
raise ValueError('{}.__spec__ is not set'.format(name)) from None
ValueError: py.__spec__ is not set

This is with py version 1.7.0 installed (pip install py)

--
components: Library (Lib)
messages: 334094
nosy: brett.cannon, eric.snow, ncoghlan, ronaldoussoren
priority: normal
severity: normal
status: open
title: Unexpected exception with importlib
type: behavior
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com