[issue17099] Raise ValueError when __loader__ not defined for importlib.find_loader()
Roundup Robot added the comment: New changeset cee04627bdd0 by Brett Cannon in branch 'default': Issue #17099: Have importlib.find_loader() raise ValueError when http://hg.python.org/cpython/rev/cee04627bdd0 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17099 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17099] Raise ValueError when __loader__ not defined for importlib.find_loader()
Brett Cannon added the comment: I decided not to backport since it shifts what exception is raised. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17099 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17099] Raise ValueError when __loader__ not defined for importlib.find_loader()
Changes by Gökcen Eraslan gokcen.eras...@gmail.com: -- nosy: +gkcn ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17099 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17099] Raise ValueError when __loader__ not defined for importlib.find_loader()
Changes by Ankur Ankan ankuran...@gmail.com: -- nosy: +Ankur.Ankan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17099 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17099] Raise ValueError when __loader__ not defined for importlib.find_loader()
Eric Snow added the comment: My vote is for making this a ValueError in both cases (and amending the doc appropriately as well). The error amounts to the same thing: the module did not have loader (implicitly or explicitly). If someone wants to distinguish between the two they can explicitly check __loader__ on the module. Incidently, _find_and_load_unlocked() has similar code to find_loader() (Lib/importlib/_bootstrap:1523) and raises ImportError instead of ValueError. That's actually fine since it's a different situation. However, _find_module() does not handle when __loader__ does not exist, so you would get neither ValueError nor ImportError. I expect we'd want it or _find_and_load_unlocked() to convert the AttributeError into ImportError to be consistent both with the fix for this issue and with how we handle the __loader__ == None case there. --- For reference, here is the original python-dev thread: http://mail.python.org/pipermail/python-dev/2013-January/123777.html The reference to ValueError is in the importlib docs: http://docs.python.org/dev/library/importlib.html#importlib.find_loader -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17099 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17099] Raise ValueError when __loader__ not defined for importlib.find_loader()
Changes by Brett Cannon br...@python.org: -- assignee: - brett.cannon ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17099 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17099] Raise ValueError when __loader__ not defined for importlib.find_loader()
New submission from Brett Cannon: If __loader__ is None then ValueError is raised, but if it is not defined then AttributeError is raised instead. Probably should harmonize around ValueError even in the missing attribute case since __loader__ = None is equivalent to the attribute not existing. I'm on the fence about considering this a bug, though, since the docs say if __loader__ == None then ValueError but does not directly mention what happens if the attribute is missing. Since anyone who has written code for this probably is catching both attributes (if at all since all but three modules coming from Python will have __loader__ defined ATM), it should be fine, but it is still a change in API/semantics that doesn't contradict the docs. -- components: Library (Lib) messages: 181079 nosy: brett.cannon, ncoghlan, theller priority: normal severity: normal stage: test needed status: open title: Raise ValueError when __loader__ not defined for importlib.find_loader() type: behavior versions: Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17099 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17099] Raise ValueError when __loader__ not defined for importlib.find_loader()
Changes by Andrew Svetlov andrew.svet...@gmail.com: -- nosy: +asvetlov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17099 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17099] Raise ValueError when __loader__ not defined for importlib.find_loader()
Changes by Barry A. Warsaw ba...@python.org: -- nosy: +barry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17099 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17099] Raise ValueError when __loader__ not defined for importlib.find_loader()
Brett Cannon added the comment: Should mention that this is probably no harder than changing a key getattr() call to None (as pointed out by Nick). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17099 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17099] Raise ValueError when __loader__ not defined for importlib.find_loader()
Changes by Brett Cannon br...@python.org: -- keywords: +easy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17099 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17099] Raise ValueError when __loader__ not defined for importlib.find_loader()
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17099 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com