[issue8754] ImportError: quote bad module name in message

2011-03-23 Thread STINNER Victor
STINNER Victor added the comment: I patched import.c to use repr() instead of str() (%R instead of %U) to format module names because they might contain surrogate characters. Surrogate characters are not encodable to any encoding, except UTF-16 and UTF-32. And so print an exception to stdout

[issue8754] ImportError: quote bad module name in message

2011-03-23 Thread Roundup Robot
Roundup Robot added the comment: New changeset 9f9b7b656761 by Brett Cannon in branch 'default': Have importlib use the repr of a module name in error messages. http://hg.python.org/cpython/rev/9f9b7b656761 -- nosy: +python-dev ___ Python tracker

[issue8754] ImportError: quote bad module name in message

2011-03-23 Thread Brett Cannon
Changes by Brett Cannon : -- assignee: -> haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyt

[issue8754] ImportError: quote bad module name in message

2011-03-20 Thread Éric Araujo
Éric Araujo added the comment: Victor changed the code to use repr in some modules but not all in c4361bab6914. -- ___ Python tracker ___

[issue8754] ImportError: quote bad module name in message

2011-03-15 Thread Nick Coghlan
Changes by Nick Coghlan : -- nosy: +ncoghlan ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue8754] ImportError: quote bad module name in message

2011-03-10 Thread Éric Araujo
Éric Araujo added the comment: Victor: Should I close this bug as superseded by yours? -- priority: high -> normal ___ Python tracker ___

[issue8754] ImportError: quote bad module name in message

2011-01-21 Thread STINNER Victor
STINNER Victor added the comment: My patch for #3080 uses repr() to format module name in all error messages. -- nosy: +haypo ___ Python tracker ___ _

[issue8754] ImportError: quote bad module name in message

2011-01-15 Thread Georg Brandl
Georg Brandl added the comment: Won't make it into 3.2. -- priority: deferred blocker -> high versions: +Python 3.3 -Python 3.2 ___ Python tracker ___ ___

[issue8754] ImportError: quote bad module name in message

2010-12-22 Thread Georg Brandl
Georg Brandl added the comment: I suppose it's not a good test, since your non-ascii name presumably was encoded in UTF-8, which is the encoding that PyUnicode_FromString uses. -- ___ Python tracker __

[issue8754] ImportError: quote bad module name in message

2010-12-21 Thread Éric Araujo
Éric Araujo added the comment: I set LANG and LC_ALL to C and tried to import a module with a non-ASCII name: $ ./python -m échec™♥ python: No module named '\udcc3\udca9chec\udce2\udc84\udca2\udce2\udc99\udca5' Is that a good enough test? I guess the “__main__ changes” you’re talking a

[issue8754] ImportError: quote bad module name in message

2010-12-19 Thread Georg Brandl
Georg Brandl added the comment: Deferring, this is not a bug. -- priority: release blocker -> deferred blocker ___ Python tracker ___

[issue8754] ImportError: quote bad module name in message

2010-12-17 Thread Georg Brandl
Georg Brandl added the comment: The change would be fine with me. What happens with the PyUnicode_FromString() usage in the patch if the string cannot be decoded? That should not lead to a UnicodeError being raised. Also, the __main__ changes look gratuitous to me. --

[issue8754] ImportError: quote bad module name in message

2010-12-16 Thread Éric Araujo
Éric Araujo added the comment: Does someone have time to review? I think this would be a good change for 3.2. Georg, please lower the priority if you think this can wait for 3.3. -- nosy: +georg.brandl priority: low -> release blocker ___ Python tr

[issue8754] ImportError: quote bad module name in message

2010-12-08 Thread Éric Araujo
Éric Araujo added the comment: > The patch looks same to me as far as I can judge. Thanks. Can you apply the patch on your Windows machine and run the test suite? > I would have used .format instead of %, but you wrote it ;-). I would have too, were I writing Python :) Here I tried to do the

[issue8754] ImportError: quote bad module name in message

2010-12-07 Thread Terry J. Reedy
Terry J. Reedy added the comment: The patch looks same to me as far as I can judge. I would have used .format instead of %, but you wrote it ;-). Seeing how many of our tests had to be patched convinced me that we should treat this like a feature request and only apply to 3.2. -- __

[issue8754] ImportError: quote bad module name in message

2010-12-07 Thread Éric Araujo
Changes by Éric Araujo : Removed file: http://bugs.python.org/file19726/import-repr.diff ___ Python tracker ___ ___ Python-bugs-list mailing li

[issue8754] ImportError: quote bad module name in message

2010-12-07 Thread Éric Araujo
Éric Araujo added the comment: I fixed my patch, thanks to a recent commit that showed me an example of PyErr_Format :) All tests now pass. -- keywords: +needs review stage: needs patch -> patch review Added file: http://bugs.python.org/file19971/import-repr.diff

[issue8754] ImportError: quote bad module name in message

2010-11-20 Thread Éric Araujo
Éric Araujo added the comment: Just for fun, I tried using my tiny understanding of C to write a patch. I am attaching my current result, which passes the test suite except for test_unittest: FAIL: test_loadTestsFromName__unknown_module_name (unittest.test.test_loader.Test_TestLoader) --

[issue8754] ImportError: quote bad module name in message

2010-11-17 Thread Éric Araujo
Éric Araujo added the comment: > A call to PyObject_Repr() (w/ proper error checking) should be all > that is needed. Sadly out of reach for me. > And no, I don't make any "you do the Python, I'll do the C" deals > because the Python part is the fun part. =) I understand :) FTR, case inconsist

[issue8754] ImportError: quote bad module name in message

2010-11-17 Thread Brett Cannon
Brett Cannon added the comment: PyErr_Format doesn't need to change, just it's argument. A call to PyObject_Repr() (w/ proper error checking) should be all that is needed. And no, I don't make any "you do the Python, I'll do the C" deals because the Python part is the fun part. =) --

[issue8754] ImportError: quote bad module name in message

2010-11-17 Thread Éric Araujo
Éric Araujo added the comment: I should have included only the one line that’s different: Lib/importlib/_bootstrap.py:811:raise ImportError("no (lower-case n) -- ___ Python tracker _

[issue8754] ImportError: quote bad module name in message

2010-11-17 Thread Éric Araujo
Éric Araujo added the comment: Thanks for the reply. Funny thing, grep revealed a small inconsistency in this error message: Python/pythonrun.c:415: * XXX Exception exceptions.ImportError: 'No module named sha' Python/import.c:1821: "No module named %.200s", name);

[issue8754] ImportError: quote bad module name in message

2010-11-17 Thread Brett Cannon
Brett Cannon added the comment: I think everyone knows that importlib is there and might need to be patched. Plus I run importlib against the entire test suite already on occasion so changes which has a proper test will eventually get caught. So just file it against core. -- ___

[issue8754] ImportError: quote bad module name in message

2010-11-17 Thread Éric Araujo
Éric Araujo added the comment: A question about process: Should every import bug be reported against core and library, so that importlib gets patched too? -- nosy: +eric.araujo versions: -Python 2.7 ___ Python tracker

[issue8754] ImportError: quote bad module name in message

2010-05-18 Thread Brett Cannon
Brett Cannon added the comment: It wouldn't matter (at least in Python 3) as str is unicode-aware. It's more about whether it's worth special-casing the output. I say no and just go with using the repr. -- ___ Python tracker

[issue8754] ImportError: quote bad module name in message

2010-05-18 Thread Terry J. Reedy
Terry J. Reedy added the comment: A refinement would be to only quote when there is whitespace in the name, but I do not know how well that works with unicode versus ascii. -- ___ Python tracker __

[issue8754] ImportError: quote bad module name in message

2010-05-18 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/op

[issue8754] ImportError: quote bad module name in message

2010-05-18 Thread Terry J. Reedy
Terry J. Reedy added the comment: I refinement would be to only quote when there is whitespace in the name, but I do not know how well that works with unicode versus ascii. -- ___ Python tracker __

[issue8754] ImportError: quote bad module name in message

2010-05-18 Thread Brett Cannon
Changes by Brett Cannon : -- keywords: +easy ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue8754] ImportError: quote bad module name in message

2010-05-18 Thread Brett Cannon
Brett Cannon added the comment: I guess it's a question of readability. Does:: ImportError: No module named mod read better than:: ImportError: No module named 'mod' In my eyes it doesn't by much, so switching to using repr() seems reasonable. This can't be changed in released versions

[issue8754] ImportError: quote bad module name in message

2010-05-18 Thread Terry J. Reedy
New submission from Terry J. Reedy : ImportError messages should quote the name it cannot import since the actual problem may be whitespace in the name that is currently invisible in the message. In other words, display ImportError: no module named 'bad name\r' instead of ImportError: no mo