
I'm not familiar with this test. In a release build: """ C:\Code\python\PCbuild>python ../lib/test/test_urllibnet.py testURLread (__main__.URLTimeoutTest) ... ok test_bad_address (__main__.urlopenNetworkTests) ... ok test_basic (__main__.urlopenNetworkTests) ... ok test_fileno (__main__.urlopenNetworkTests) ... ERROR test_geturl (__main__.urlopenNetworkTests) ... ok test_info (__main__.urlopenNetworkTests) ... ok test_readlines (__main__.urlopenNetworkTests) ... ok test_basic (__main__.urlretrieveNetworkTests) ... ok test_header (__main__.urlretrieveNetworkTests) ... ok test_specified_path (__main__.urlretrieveNetworkTests) ... ok ====================================================================== ERROR: test_fileno (__main__.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "../lib/test/test_urllibnet.py", line 91, in test_fileno FILE = os.fdopen(fd) OSError: (0, 'Error') ---------------------------------------------------------------------- Ran 10 tests in 7.081s FAILED (errors=1) Traceback (most recent call last): File "../lib/test/test_urllibnet.py", line 149, in ? test_main() File "../lib/test/test_urllibnet.py", line 146, in test_main urlretrieveNetworkTests) File "C:\Code\python\lib\test\test_support.py", line 259, in run_unittest run_suite(suite, testclass) File "C:\Code\python\lib\test\test_support.py", line 247, in run_suite raise TestFailed(err) test.test_support.TestFailed: Traceback (most recent call last): File "../lib/test/test_urllibnet.py", line 91, in test_fileno FILE = os.fdopen(fd) OSError: (0, 'Error') """ In a debug build: """ C:\Code\python\PCbuild>python_d ../lib/test/test_urllibnet.py testURLread (__main__.URLTimeoutTest) ... ok test_bad_address (__main__.urlopenNetworkTests) ... ok test_basic (__main__.urlopenNetworkTests) ... ok test_fileno (__main__.urlopenNetworkTests) ... """ and there it dies with an assertion error in the bowels of Microsoft's fdopen.c. That's called by Python's posix_fdopen, here: fp = fdopen(fd, mode); At this point, fd is 436. MS's fdopen is unhappy because only 32 handles actually exist at this point, and 436 is bigger than that. In the release build, the MS assert doesn't (of course) trigger; instead, that 436 >= 32 causes MS's fdopen to return NULL.