Message121853
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 :) |
|
Date |
User |
Action |
Args |
2010-11-21 03:28:18 | eric.araujo | set | recipients:
+ eric.araujo, brett.cannon, terry.reedy |
2010-11-21 03:28:17 | eric.araujo | set | messageid: <1290310097.78.0.836254102262.issue8754@psf.upfronthosting.co.za> |
2010-11-21 03:28:15 | eric.araujo | link | issue8754 messages |
2010-11-21 03:28:15 | eric.araujo | create | |
|