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

Function read_int4

Lib/pickletools.py:252–264  ·  view source on GitHub ↗

r""" >>> import io >>> read_int4(io.BytesIO(b'\xff\x00\x00\x00')) 255 >>> read_int4(io.BytesIO(b'\x00\x00\x00\x80')) == -(2**31) True

(f)

Source from the content-addressed store, hash-verified

250
251
252def read_int4(f):
253 r"""
254 >>> import io
255 >>> read_int4(io.BytesIO(b'\xff\x00\x00\x00'))
256 255
257 >>> read_int4(io.BytesIO(b'\x00\x00\x00\x80')) == -(2**31)
258 True
259 """
260
261 data = f.read(4)
262 if len(data) == 4:
263 return _unpack("<i", data)[0]
264 raise ValueError("not enough data in stream to read int4")
265
266int4 = ArgumentDescriptor(
267 name='int4',

Callers 2

read_string4Function · 0.85
read_long4Function · 0.85

Calls 1

readMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…