comparison mercurial/win32.py @ 51700:7f0cb9ee0534

Backout accidental publication of a large range of revisions I accidentally published 25e7f9dcad0f::bd1483fd7088, this is the inverse.
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 23 Jul 2024 10:02:46 +0200
parents 493034cc3265
children ca7bde5dbafb
comparison
equal deleted inserted replaced
51699:bd1483fd7088 51700:7f0cb9ee0534
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
176 # These structs are only complete enough to achieve what we need. 175 # These structs are only complete enough to achieve what we need.
177 class CERT_CHAIN_CONTEXT(ctypes.Structure): 176 class CERT_CHAIN_CONTEXT(ctypes.Structure):
178 _fields_ = ( 177 _fields_ = (
179 ("cbSize", _DWORD), 178 ("cbSize", _DWORD),
180 # CERT_TRUST_STATUS struct 179 # CERT_TRUST_STATUS struct
367 def _raiseoserror(name: bytes) -> NoReturn: 366 def _raiseoserror(name: bytes) -> NoReturn:
368 # Force the code to a signed int to avoid an 'int too large' error. 367 # Force the code to a signed int to avoid an 'int too large' error.
369 # See https://bugs.python.org/issue28474 368 # See https://bugs.python.org/issue28474
370 code = _kernel32.GetLastError() 369 code = _kernel32.GetLastError()
371 if code > 0x7FFFFFFF: 370 if code > 0x7FFFFFFF:
372 code -= 2**32 371 code -= 2 ** 32
373 err = ctypes.WinError(code=code) # pytype: disable=module-attr 372 err = ctypes.WinError(code=code) # pytype: disable=module-attr
374 raise OSError( 373 raise OSError(
375 err.errno, '%s: %s' % (encoding.strfromlocal(name), err.strerror) 374 err.errno, '%s: %s' % (encoding.strfromlocal(name), err.strerror)
376 ) 375 )
377 376