msg278414 - (view) |
Author: Berker Peksag (berker.peksag) *  |
Date: 2016-10-10 13:04 |
Here's an updated patch with different tests and documentation changes. I simplified Lib/tarfile.py a bit (see my review comments) A slightly off-topic question: I had to update both docstrings and documentation. Should we use this as an opportunity to simplify the docstrings? |
|
|
msg278416 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2016-10-10 13:36 |
There are two kinds of paths in tarinfo: 1) External paths that correspond to filesystem paths. The path of the tar file itself, patches of added files and target directory for extraction. Supporting path protocol looks reasonable for them. 1) Internal paths, they are just string keys inside an archive. They come from TarFile.getnames() and always are strings. I'm not sure that pathlib have relation to this. This issue needs more thoughts. I would not haste with this. |
|
|
msg278428 - (view) |
Author: Ethan Furman (ethan.furman) *  |
Date: 2016-10-10 16:45 |
As Serhiy was alluding to, if the incoming path is for the actual tar file and is only passed along to Python itself then we probably don't need to worry about os.fspath(). For names that will be interally stored, or are for accessing internal files, then the proper sequence is check for and call os.fspath if necessary, and then double-check that the name to be used is a str. The double-check is needed because os.fspath may return a bytes object, which tar does not allow. |
|
|
msg278444 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2016-10-10 21:06 |
It seems to me that tarfile already supports path protocol for all external patches and no changes for tarfile are needed. Proposed patch adds tests for (already implemented) support of pathlike protocol in tarfile. |
|
|
msg288604 - (view) |
Author: Berker Peksag (berker.peksag) *  |
Date: 2017-02-26 17:21 |
Serhiy's patch looks good to me, but it would be nice to document the support for PathLike objects in the tarfile documentation. |
|
|
msg289096 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2017-03-06 11:41 |
Updated documentation. Note that path-like objects are supported only for external names. Internal names are not OS paths. |
|
|
msg289671 - (view) |
Author: Berker Peksag (berker.peksag) *  |
Date: 2017-03-15 12:52 |
PR 512 has been merged and backported to 3.6 branch. I think this can be closed now. Thanks, Ethan and Serhiy! |
|
|
msg290265 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2017-03-24 22:41 |
New changeset 666165fddf499e80d10a5d9263846ec4534f6a2a by Serhiy Storchaka in branch '3.6': [3.6] bpo-28230: Document the pathlib support in tarfile and add tests. (#559) https://github.com/python/cpython/commit/666165fddf499e80d10a5d9263846ec4534f6a2a |
|
|
msg290267 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2017-03-24 22:41 |
New changeset c45cd167d403d7d98078d5fc4a37b16195dc7a35 by Serhiy Storchaka in branch 'master': bpo-28230: Document the pathlib support in tarfile and add tests. (#512) https://github.com/python/cpython/commit/c45cd167d403d7d98078d5fc4a37b16195dc7a35 |
|
|