Guido van Rossum wrote: > WindowsError should have used a different name for the Windows-native > error code, so we could have defined both separately without > confusion. > > Is it too late to change WindowsError in that way?
We could define a different exception, say, Win32Error which inherits from OSError, and has a POSIX errno in the errno attribute, and also an additional attribute win32_error. We could then stop raising WindowsError. So code that expects WindowsError will never see it, but will see OSError instead (which it also should handle if it was written portable). Or we could just break the errno value in WindowsError, which would make code that catches WindowsError continue to work, but break code that looks for specific errno values in WindowsError. Code aiming for backwards compatibility should then write except WindowsError, e: try: windows_error = e.windows_error except NameError: # Python 2.4 and earlier windows_error = e.errno As for naming, I would like to avoid naming new things Win32: Microsoft just changed the name of the API to "Windows API" (pointing out that it isn't necessarily 32 bits anymore). Regards, Martin _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com