[Python-ideas] Do not block threads when pickle/unpickle

Joseph Jevnik joejev at gmail.com
Mon Jul 16 14:05:35 EDT 2018


The GIL must be held to allocate memory for Python objects and to
invoke the Python code to deserialize user defined picklable objects.
I don't think there is a long span of time where the code could leave
the GIL released. The Python implementation is just pausing to let
other Python threads run, but it is not actually able to parallelize.
The same would be true of the C implementation, is there a reason to
want to pause the thread to let another thread run?

On Mon, Jul 16, 2018 at 1:56 PM, Martin Bammer <mrbm74 at gmail.com> wrote:
> Hi,
>
> the old and slow python implementation of pickle didn't block background
> thread.
>
> But the newer C-implementation blocks other threads while dump/load is
> running.
>
> Wouldn't it be possible to allow other threads during this time?
>
> Especially could load/loads release the GIL, because Python objects are not
> available to the Python code until these functions have finished?
>
> Regards,
>
> Martin
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/


More information about the Python-ideas mailing list