Ticket #5364: winerror2.patch

File winerror2.patch, 1.2 KB (added by Antoine Pitrou, 10 years ago)
  • twisted/python/win32.py

    diff -r f0773f8fb254 twisted/python/win32.py
    a b  
    156156        @rtype: C{str}
    157157        """
    158158        if self.winError is not None:
    159             return self.winError(errorcode)[1]
     159            return self.winError(errorcode).strerror
    160160        if self.formatMessage is not None:
    161161            return self.formatMessage(errorcode)
    162162        if self.errorTab is not None:
  • twisted/test/test_strerror.py

    diff -r f0773f8fb254 twisted/test/test_strerror.py
    a b  
    1414from twisted.python.runtime import platform
    1515
    1616
     17class _MyWindowsException(OSError):
     18    pass
     19
    1720
    1821class ErrorFormatingTestCase(TestCase):
    1922    """
     
    8184        winCalls = []
    8285        def winError(errorCode):
    8386            winCalls.append(errorCode)
    84             return (errorCode, self.probeMessage)
     87            return _MyWindowsException(errorCode, self.probeMessage)
    8588        formatter = _ErrorFormatter(
    8689            winError,
    8790            lambda error: 'formatMessage: wrong message',