Jason R. Coombs added the comment: 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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue16396> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com