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

Function read_long4

Lib/pickletools.py:905–926  ·  view source on GitHub ↗

r""" >>> import io >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\xff\x00")) 255 >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\xff\x7f")) 32767 >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\x00\xff")) -256 >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\x00\x80")) -32768

(f)

Source from the content-addressed store, hash-verified

903 """)
904
905def read_long4(f):
906 r"""
907 >>> import io
908 >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\xff\x00"))
909 255
910 >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\xff\x7f"))
911 32767
912 >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\x00\xff"))
913 -256
914 >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\x00\x80"))
915 -32768
916 >>> read_long1(io.BytesIO(b"\x00\x00\x00\x00"))
917 0
918 """
919
920 n = read_int4(f)
921 if n < 0:
922 raise ValueError("long4 byte count < 0: %d" % n)
923 data = f.read(n)
924 if len(data) != n:
925 raise ValueError("not enough data in stream to read long4")
926 return decode_long(data)
927
928long4 = ArgumentDescriptor(
929 name="long4",

Callers

nothing calls this directly

Calls 3

decode_longFunction · 0.90
read_int4Function · 0.85
readMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…