This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author remi.lapeyre
Recipients remi.lapeyre
Date 2020-06-02.11:05:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1591095903.49.0.200421685869.issue40842@roundup.psfhosted.org>
In-reply-to
Content
I'm currently investigating a SystemError one of our workers returned:

   <method 'dump' of '_pickle.Pickler' objects> returned NULL without setting an error


While doing so I came across the _Pickler_CommitFrame() function:


static int
_Pickler_CommitFrame(PicklerObject *self)
{
    size_t frame_len;
    char *qdata;

    if (!self->framing || self->frame_start == -1)
        return 0;
    frame_len = self->output_len - self->frame_start - FRAME_HEADER_SIZE;
    qdata = PyBytes_AS_STRING(self->output_buffer) + self->frame_start;
    if (frame_len >= FRAME_SIZE_MIN) {
        qdata[0] = FRAME;
        _write_size64(qdata + 1, frame_len);
    }
    else {
        memmove(qdata, qdata + FRAME_HEADER_SIZE, frame_len);
        self->output_len -= FRAME_HEADER_SIZE;
    }
    self->frame_start = -1;
    return 0;
}


Is there a reason for this function to return an int if it is always 0? I checked all call sites (_Pickler_GetString(), _Pickler_OpcodeBoundary(), _Pickler_write_bytes() and dump()) and they all check the return code but it seems useless.
History
Date User Action Args
2020-06-02 11:05:03remi.lapeyresetrecipients: + remi.lapeyre
2020-06-02 11:05:03remi.lapeyresetmessageid: <1591095903.49.0.200421685869.issue40842@roundup.psfhosted.org>
2020-06-02 11:05:03remi.lapeyrelinkissue40842 messages
2020-06-02 11:05:03remi.lapeyrecreate