Message195924
The first thing it helps is that it eliminates a ValueError on import. Without it, code must catch both ValueError and ImportError to run portably:
import ctypes
try:
import ctypes.wintypes
except ImportError, ValueError:
# catch ImportError and ValueError due to issue16396
pass
...
def code_that_runs_only_on_win():
ctypes.wintypes.foo
One _could_ cause ctypes.wintypes to always raise an ImportError on non-Windows systems, allowing the import routine to be simpler:
try:
import ctypes.wintypes
except ImportError:
pass
But it would be even nicer if ctypes.wintypes always imported on any platform, such that the statement could be simply:
import ctypes.wintypes
But it's conceivable that certain functionality in wintypes might be useful on other systems. Consider, for example, a routine that works with pickles produced on a Windows system, or simply a comparison of some object in ctypes.wintypes against a value produced on a Windows system.
The argument for that need (esp. on Python 2.7) is not strong, but since the patch to address the ValueError is simple, straightforward, and perhaps even simpler than something that would address the ValueError specifically, it seems worthwhile to accept the patch. |
|
Date |
User |
Action |
Args |
2013-08-22 21:39:03 | jaraco | set | recipients:
+ jaraco, amaury.forgeotdarc, belopolsky, techtonik, christian.heimes, benjamin.peterson, ezio.melotti, meador.inge, dmi.baranov |
2013-08-22 21:39:03 | jaraco | set | messageid: <1377207543.85.0.732024068503.issue16396@psf.upfronthosting.co.za> |
2013-08-22 21:39:03 | jaraco | link | issue16396 messages |
2013-08-22 21:39:03 | jaraco | create | |
|