pytest-dev / py

Python development support library (note: maintenance only)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

py.__spec__ is not set

undera opened this issue · comments

Something inside lib does replace original module with another object, missing __spec__ attribute. Because of this, importlib raises exception when trying to find spec of py.

I have simplified my usecase to the following minimal code:

from importlib import util as importlib_util

import py

importlib_util.find_spec(py.__name__)

It raises ValueError.

py does some funky stuff with its top-level package (see apipkg for more details). I personally am not a fan but it is/was considered a feature, and is unlikely to change at this point...

Should we consider this for apipkg and the devendoring

Why not just fix it by adding __spec__ copying, the same way other properties are copied?

It has to be fixed in apipkg and re-vendored or devendored in pylib