diff options
author | Mark Shannon <mark@hotpy.org> | 2022-07-25 11:11:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-25 11:11:06 (GMT) |
commit | e5ff5ec3ffb869ff410311c57aa05ff8fb17956a (patch) | |
tree | 0405658d24aea77ead4857917e2457ef21a0f563 /Include | |
parent | df95ad3d721f90bd1339fa12353d9b633ad9d27e (diff) | |
download | cpython-e5ff5ec3ffb869ff410311c57aa05ff8fb17956a.zip cpython-e5ff5ec3ffb869ff410311c57aa05ff8fb17956a.tar.gz cpython-e5ff5ec3ffb869ff410311c57aa05ff8fb17956a.tar.bz2 |
[3.11] GH-94739: Backport GH-94958 to 3.11 (#94965)
Diffstat (limited to 'Include')
-rw-r--r-- | Include/internal/pycore_code.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h index 9528c89..3a24a65 100644 --- a/Include/internal/pycore_code.h +++ b/Include/internal/pycore_code.h @@ -438,6 +438,19 @@ read_obj(uint16_t *p) return (PyObject *)val; } +/* See Objects/exception_handling_notes.txt for details. + */ +static inline unsigned char * +parse_varint(unsigned char *p, int *result) { + int val = p[0] & 63; + while (p[0] & 64) { + p++; + val = (val << 6) | (p[0] & 63); + } + *result = val; + return p+1; +} + static inline int write_varint(uint8_t *ptr, unsigned int val) { |