[issue40358] pathlib's relative_to should behave like os.path.relpath

2020-05-28 Thread Domenico Ragusa
Domenico Ragusa added the comment: I've solved the conflicts with GH-19611 (bpo-23082: Better error message for PurePath.relative_to() from pathlib) that was merged in the mean time and improved the documentation. Everything appears to be in order, can you take a look

[issue40506] add support for os.Pathlike filenames in zipfile.ZipFile.writestr

2020-05-08 Thread Domenico Ragusa
Change by Domenico Ragusa : -- pull_requests: +19314 stage: -> patch review pull_request: https://github.com/python/cpython/pull/20002 ___ Python tracker <https://bugs.python.org/issu

[issue40506] add support for os.Pathlike filenames in zipfile.ZipFile.writestr

2020-05-06 Thread Domenico Ragusa
Domenico Ragusa added the comment: Here's a small patch to do this. Everything seems to work fine. I don't know if where I placed the test (in OtherTests) is the most appropriate. On Tue, May 5, 2020 at 4:12 AM Domenico Ragusa wrote: > > > New submission from Domenico Ragusa : &g

[issue40506] add support for os.Pathlike filenames in zipfile.ZipFile.writestr

2020-05-04 Thread Domenico Ragusa
New submission from Domenico Ragusa : ZipFile seems to support Pathlike objects pretty well, except in ZipFile.writestr. For example: >>> a = ZipFile(Path('test.zip'), 'w') # this works ok >>> a.write(Path('./foo.jpeg'), arcname=PurePath('/some/thing.jpeg')) # this

[issue40358] pathlib's relative_to should behave like os.path.relpath

2020-04-30 Thread Domenico Ragusa
Change by Domenico Ragusa : -- pull_requests: +19133 pull_request: https://github.com/python/cpython/pull/19813 ___ Python tracker <https://bugs.python.org/issue40

[issue40358] pathlib's relative_to should behave like os.path.relpath

2020-04-29 Thread Domenico Ragusa
Domenico Ragusa added the comment: I may have forgotten to use the proper format for the title of each commit, should I delete the pull request and make a new one or can it be fixed when (or if) it's pulled? On Thu, Apr 30, 2020 at 2:03 AM Roundup Robot wrote: > > > Change by Roun

[issue40358] pathlib's relative_to should behave like os.path.relpath

2020-04-27 Thread Domenico Ragusa
Domenico Ragusa added the comment: Yeah, you're right, there's no access to the filesystem and the result is generated assuming the paths are already resolved. `strict` seems to be an appropriate name for the option, thanks. I've looked into the test suite, it helped a lot especially

[issue40358] pathlib's relative_to should behave like os.path.relpath

2020-04-27 Thread Domenico Ragusa
Change by Domenico Ragusa : Removed file: https://bugs.python.org/file49081/pathlib.diff ___ Python tracker <https://bugs.python.org/issue40358> ___ ___ Python-bug

[issue40358] pathlib's relative_to should behave like os.path.relpath

2020-04-22 Thread Domenico Ragusa
Domenico Ragusa added the comment: Thanks for your answer. Yeah, I'm new, I'm reading the guide, sorry for any faux pas :) Ok, an option would be great as well, a simple True/False switch? Any suggestion for the name? I'll get back with a proper patch this time. On Wed, Apr 22, 2020 at 8:18

[issue40358] pathlib's relative_to should behave like os.path.relpath

2020-04-21 Thread Domenico Ragusa
New submission from Domenico Ragusa : Can we improve pathlib.relative_to(other) so that it handles the case of a path not being a direct child of other, like os.path.relpath? For example: Path('/some/thing').relative_to('/foo') -> Path('../some/thing') At the moment it just rai