Éric Araujo <mer...@netwok.org> 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) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/wok/code/hg/cpython/3.2/fix-import-repr/Lib/unittest/test/test_loader.py", line 240, in test_loadTestsFromName__unknown_module_name loader.loadTestsFromName('sdasfasfasdf') ImportError: No module named 0I� During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/wok/code/hg/cpython/3.2/fix-import-repr/Lib/unittest/test/test_loader.py", line 242, in test_loadTestsFromName__unknown_module_name self.assertEqual(str(e), "No module named 'sdasfasfasdf'") AssertionError: 'No module named 0I�\x01' != "No module named 'sdasfasfasdf'" - No module named 0I� + No module named 'sdasfasfasdf' ====================================================================== FAIL: test_loadTestsFromNames__unknown_module_name (unittest.test.test_loader.Test_TestLoader) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/unittest/test/test_loader.py", line 620, in test_loadTestsFromNames__unknown_module_name loader.loadTestsFromNames(['sdasfasfasdf']) ImportError: No module named HB� During handling of the above exception, another exception occurred: Traceback (most recent call last): File "Lib/unittest/test/test_loader.py", line 622, in test_loadTestsFromNames__unknown_module_name self.assertEqual(str(e), "No module named 'sdasfasfasdf'") AssertionError: 'No module named HB�\x01' != "No module named 'sdasfasfasdf'" - No module named HB� + No module named 'sdasfasfasdf' test_imp{,ort,ortlib} pass, though. Maybe someone will take my patch and fix the PyObject_Repr call and error checking. It was a fun bit of experimenting with help from kind people on IRC :) ---------- keywords: +patch Added file: http://bugs.python.org/file19726/import-repr.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8754> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com