383ea0326ae103b5d5e0b62ed9c3cb18510c5b9e,distributed/comm/tcp.py,TCP,read,#TCP#Any#,185

Before Change



        try:
            n_frames = await stream.read_bytes(8)
            n_frames = struct.unpack("Q", n_frames)[0]
            lengths = await stream.read_bytes(8 * n_frames)
            lengths = struct.unpack("Q" * n_frames, lengths)

            frames = []
            for length in lengths:
                frame = bytearray(length)
                if length:
                    n = await stream.read_into(frame)
                    assert n == length, (n, length)
                frames.append(frame)
        except StreamClosedError as e:
            self.stream = None
            self._closed = True
            if not shutting_down():

After Change


            raise CommClosedError

        fmt = "Q"
        fmt_size = struct.calcsize(fmt)

        try:
            frames_nbytes = await stream.read_bytes(fmt_size)
            (frames_nbytes,) = struct.unpack(fmt, frames_nbytes)

            frames = bytearray(frames_nbytes)
            n = await stream.read_into(frames)
            assert n == frames_nbytes, (n, frames_nbytes)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: dask/distributed
Commit Name: 383ea0326ae103b5d5e0b62ed9c3cb18510c5b9e
Time: 2021-02-17
Author: jakirkham@gmail.com
File Name: distributed/comm/tcp.py
Class Name: TCP
Method Name: read


Project Name: dask/distributed
Commit Name: 1dba1622049dd957dfce138618e4ee4180222b4a
Time: 2020-07-21
Author: jakirkham@gmail.com
File Name: distributed/protocol/utils.py
Class Name:
Method Name: unpack_frames


Project Name: ekzhu/datasketch
Commit Name: cd91a294f32206728436890be3e697b6c1325841
Time: 2015-04-08
Author: erkangzhu@gmail.com
File Name: datasketch/minhash.py
Class Name: MinHash
Method Name: __setstate__