[issue27175] Unpickling Path objects

2021-09-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: _compat_pickle is only used with protocol < 3. -- ___ Python tracker ___ ___ Python-bugs-list

[issue27175] Unpickling Path objects

2021-09-01 Thread Antony Lee
Antony Lee added the comment: I guess I could instead add some OS-dependent entries for Path classes into _compat_pickle (to do the remapping at load time) if you prefer? I don't have a strong preference either-way. -- ___ Python tracker

[issue27175] Unpickling Path objects

2021-09-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It would be nice to have simple general mechanism for everloading names of modules, classes and functions, similar to _compat_pickle. Currently you can do this with creating a subclass of Unpickler and overloading find_class(), but it is not so

[issue27175] Unpickling Path objects

2021-08-31 Thread Antoine Pitrou
Change by Antoine Pitrou : -- type: behavior -> enhancement versions: +Python 3.11 -Python 3.6 ___ Python tracker ___ ___

[issue27175] Unpickling Path objects

2021-08-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Pickling Patch can be useful in multiprocessing, you can pass the Patch argument to function executed in other process. It can also be useful if you save the state of your program and restore it at the next start. In both cases you pickle and unpickle on

[issue27175] Unpickling Path objects

2021-08-31 Thread Antoine Pitrou
Antoine Pitrou added the comment: I understand. Unpickling to PurePath might make enough sense indeed... -- ___ Python tracker ___

[issue27175] Unpickling Path objects

2021-08-31 Thread Antony Lee
Antony Lee added the comment: Despite the now well-known security limitations of pickle, it is still used as a simple way (from the user PoV) to exchange arbitrary Python objects (see e.g. https://joblib.readthedocs.io/en/latest/persistence.html). Such objects can sometimes include Paths

[issue27175] Unpickling Path objects

2021-08-31 Thread Antoine Pitrou
Antoine Pitrou added the comment: I guess the question is: why do people expect Paths to be picklable accross platforms? Is there a particular use case? -- ___ Python tracker

[issue27175] Unpickling Path objects

2021-08-31 Thread Antony Lee
Antony Lee added the comment: You are correct as to the meaning of "convert". The alternative approach you suggest would also work, but that seems to go much more against the design of pathlib to me. OTOH I guess it is up to Antoine to rule on that. --

[issue27175] Unpickling Path objects

2021-08-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think that you mean that PosixPath will be converted to PurePosixPath on Windows, and WindowsPath will be converted to PureWindowsPath on Posix. In can be easily achieved by making alias PosixPath=PurePosixPath on Windows and WindowsPath=PureWindowsPath

[issue27175] Unpickling Path objects

2021-08-31 Thread Antony Lee
Antony Lee added the comment: It means the Path/PurePath that would be constructed with the same single str parameter, or equivalently that has the same os.fspath(). -- ___ Python tracker

[issue27175] Unpickling Path objects

2021-08-31 Thread Antoine Pitrou
Antoine Pitrou added the comment: What does "converting" mean in this context? -- ___ Python tracker ___ ___ Python-bugs-list

[issue27175] Unpickling Path objects

2021-08-31 Thread Antony Lee
Change by Antony Lee : -- keywords: +patch pull_requests: +26526 stage: -> patch review pull_request: https://github.com/python/cpython/pull/28083 ___ Python tracker ___

[issue27175] Unpickling Path objects

2016-06-01 Thread SilentGhost
Changes by SilentGhost : -- nosy: +pitrou type: -> behavior versions: -Python 3.5 ___ Python tracker ___

[issue27175] Unpickling Path objects

2016-06-01 Thread Antony Lee
New submission from Antony Lee: Currently, pickling Path objects lead to issues when working across platforms: Paths (and, thus, objects that contain Paths) created on a POSIX platform (PosixPaths) cannot be unpickled on Windows and vice versa. There are a few possibilities around this