MCPcopy Index your code
hub / github.com/python/cpython / parse_err_h

Function parse_err_h

Tools/ssl/make_ssl_data.py:106–125  ·  view source on GitHub ↗

Parse error codes from include/openssl/err.h.in. Detected lines match (up to spaces) "#define ERR_LIB_ ", e.g., "# define ERR_LIB_NONE 1".

(args)

Source from the content-addressed store, hash-verified

104
105
106def parse_err_h(args):
107 """Parse error codes from include/openssl/err.h.in.
108
109 Detected lines match (up to spaces) "#define ERR_LIB_<LIBNAME> <ERRCODE>",
110 e.g., "# define ERR_LIB_NONE 1".
111 """
112 pat = re.compile(r"#\s*define\W+(ERR_LIB_(\w+))\s+(\d+)")
113 lib2errnum = {}
114 for match in _file_search(args.err_h, pat):
115 macroname, libname, num = match.groups()
116 if macroname in ['ERR_LIB_OFFSET', 'ERR_LIB_MASK']:
117 # ignore: "# define ERR_LIB_OFFSET 23L"
118 # ignore: "# define ERR_LIB_MASK 0xFF"
119 continue
120 actual = int(num)
121 expect = lib2errnum.setdefault(libname, actual)
122 if actual != expect:
123 logger.warning("OpenSSL inconsistency for ERR_LIB_%s (%d != %d)",
124 libname, actual, expect)
125 return lib2errnum
126
127
128def parse_openssl_error_text(args):

Callers 1

mainFunction · 0.85

Calls 5

_file_searchFunction · 0.85
compileMethod · 0.45
groupsMethod · 0.45
setdefaultMethod · 0.45
warningMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…