[Python-Dev] Usage of tafile.copyfileobj

Rémi Lapeyre remi.lapeyre at henki.fr
Sat Nov 24 14:32:40 EST 2018


Hi, I’m working on the tarfile module to add support for file objects
whose size is not know beforehand (https://bugs.python.org/issue35227).

In doing so, I need to adapt `tarfile.copyfileobj` to return the length
of the file after it has been copied.

Calling this function with `length=None` currently leads to data being
copied but without adding the necessary padding. This seems weird to me,
I do not understand why this would be needed and this behaviour is currently
not used.

This function is not documented in Python documentation so nobody is probably
using it.

Can I safely change `tarfile.copyfileobj` to make it write the padding when
`length=None`?

Thanks,
Rémi


More information about the Python-Dev mailing list