[issue39974] A race condition with GIL releasing exists in stringlib_bytes_join

tzickel report at bugs.python.org
Mon Mar 16 03:38:21 EDT 2020


tzickel <icebreak at yahoo.com> added the comment:

Also, semi related, (dunno where to discuss it), would a good .join() optimization be to add an optional length parameter, like .join(iterable, length=10), and when running in that code-path, it would skip all the calls to (PySequence_Fast which converts no list to list), and all the pre calculation of length to calculate allocation size, and instead directly start copying from input until length is done, and if the iterable didn't have enough length to fill up, only then throw an exception ?

There are places where you know how much information you expect to be .joining (or you want to join just a part of it) ?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39974>
_______________________________________


More information about the Python-bugs-list mailing list