On 4/23/24 8:11 PM, Giancarlo Razzolini wrote:
Just to be sure, `importlib.util.spec_from_file_location()` is unchanged correct? I've read the change log up and down a couple of times, and it appears to only affect the `imp` lib specifically and I think I've covered my bases.
But just for my own sanity, have I correctly understood the change in 3.13 in my above reasoning? Otherwise I will be guilty of issues in `archinstall` since I use `importlib.util` quite heavily. Relevant docks on the imp removal and alternatives [0]. Also, for reference,
Excerpts from Anton Hvornum's message of abril 23, 2024 2:06 pm: the PR I made against the upstream project to fix imp's removal issue [1].
Looks like the most affect imp function is load_source(), as there's no direct replacement for it on importlib.
[0] https://docs.python.org/3/whatsnew/3.12.html#imp [1] https://github.com/enkore/i3pystatus/pull/865/
Regards, Giancarlo Razzolini
Thank you! I appear to follow their recommendations [0] with the slight exception of ignoring the explicit loader, as I've chosen to fail if no loader could be automatically found. It could perhaps be worth noting that when we do help out or migrate existing code from `imp`, we (and I) should explicitly `import importlib.util` as it is not exposed in `importlib/__init__.py` by default. But is commonly exposed through other libraries such as `matplotlib` through their existence alone on the system [1]. [0] https://github.com/archlinux/archinstall/blob/beeb9d7fde8db7ed0dc9fb10cf7eec... [1] https://discuss.python.org/t/python3-11-importlib-no-longer-exposes-util/256... //Anton