classification
Title: distutils2.utils.resolve_name cannot be implemented to give correct errors in all situations
Type: Stage: resolved
Components: Distutils2 Versions:
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Improve error reporting for packaging.util.resolve_name
View: 12703
Assigned To: eric.araujo Nosy List: Ronny.Pfannschmidt, alexis, eric.araujo, tarek
Priority: normal Keywords:

Created on 2012-05-31 11:34 by Ronny.Pfannschmidt, last changed 2012-07-03 04:39 by eric.araujo. This issue is now closed.

Messages (6)
msg161990 - (view) Author: Ronny Pfannschmidt (Ronny.Pfannschmidt) Date: 2012-05-31 11:34
due to the lack of a marker that denotes where the module ends and the attribute starts, unrelated import errors can break the try&error chain at unexpected places and the code can pass on to the recursive getattr chain, giving a completely different error instead of the real error

this is not solvable without a marker or really nasty hacks o track subsequent imports
msg161991 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2012-05-31 12:01
the current code works as expected. Why not leaving it like this since your change seem to be comsetics only ?
msg161992 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2012-05-31 12:01
can you give an example of a bad error ?
msg161993 - (view) Author: Ronny Pfannschmidt (Ronny.Pfannschmidt) Date: 2012-05-31 12:26
to correctly implement it we need the : separator back

with the separator the import specification is no longer ambigious,
and we can use one exact import, and an error will always be an error
msg161994 - (view) Author: Ronny Pfannschmidt (Ronny.Pfannschmidt) Date: 2012-05-31 12:29
an example of creating a wrong error would be something like the following:

there is a package foo.bar, which does a wrong import in __init__.py
we want to resolve the name foo.bar.something

we'd get the error that foo has no attribute bar
msg164568 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-07-03 04:39
Please keep the discussion in one place, the other bug report.
History
Date User Action Args
2012-07-03 04:39:03eric.araujosetstatus: open -> closed

messages: + msg164568
stage: resolved
2012-05-31 12:29:03Ronny.Pfannschmidtsetmessages: + msg161994
2012-05-31 12:26:52Ronny.Pfannschmidtsetmessages: + msg161993
2012-05-31 12:03:42tareksetresolution: duplicate
superseder: Improve error reporting for packaging.util.resolve_name
2012-05-31 12:01:57tareksetmessages: + msg161992
2012-05-31 12:01:25tareksetmessages: + msg161991
2012-05-31 11:34:36Ronny.Pfannschmidtcreate