comparison mercurial/win32.py @ 51699:ca7bde5dbafb

black: format the codebase with 23.3.0 The CI has moved to 23.3.0, which is the last version that supports 3.7 at runtime, so we should honor this change. # skip-blame mass-reformating only
author Rapha?l Gom?s <rgomes@octobus.net>
date Thu, 18 Jul 2024 12:36:12 +0200
parents 7f0cb9ee0534
children e618a1756b08
comparison
equal deleted inserted replaced
51698:b0a4de6c14f8 51699:ca7bde5dbafb
170 170
171 # CertCreateCertificateContext encodings 171 # CertCreateCertificateContext encodings
172 X509_ASN_ENCODING = 0x00000001 172 X509_ASN_ENCODING = 0x00000001
173 PKCS_7_ASN_ENCODING = 0x00010000 173 PKCS_7_ASN_ENCODING = 0x00010000
174 174
175
175 # These structs are only complete enough to achieve what we need. 176 # These structs are only complete enough to achieve what we need.
176 class CERT_CHAIN_CONTEXT(ctypes.Structure): 177 class CERT_CHAIN_CONTEXT(ctypes.Structure):
177 _fields_ = ( 178 _fields_ = (
178 ("cbSize", _DWORD), 179 ("cbSize", _DWORD),
179 # CERT_TRUST_STATUS struct 180 # CERT_TRUST_STATUS struct
366 def _raiseoserror(name: bytes) -> NoReturn: 367 def _raiseoserror(name: bytes) -> NoReturn:
367 # Force the code to a signed int to avoid an 'int too large' error. 368 # Force the code to a signed int to avoid an 'int too large' error.
368 # See https://bugs.python.org/issue28474 369 # See https://bugs.python.org/issue28474
369 code = _kernel32.GetLastError() 370 code = _kernel32.GetLastError()
370 if code > 0x7FFFFFFF: 371 if code > 0x7FFFFFFF:
371 code -= 2 ** 32 372 code -= 2**32
372 err = ctypes.WinError(code=code) # pytype: disable=module-attr 373 err = ctypes.WinError(code=code) # pytype: disable=module-attr
373 raise OSError( 374 raise OSError(
374 err.errno, '%s: %s' % (encoding.strfromlocal(name), err.strerror) 375 err.errno, '%s: %s' % (encoding.strfromlocal(name), err.strerror)
375 ) 376 )
376 377