[issue20680] Pickle socket enums by names
Serhiy Storchaka added the comment: Thanks Ethan. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20680 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20680] Pickle socket enums by names
Ethan Furman added the comment: Enum members that are replacing constants now pickle by name (see issue23673). -- resolution: - duplicate stage: patch review - resolved status: open - closed superseder: - IntEnum is unpicklable by previous Python versions ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20680 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20680] Pickle socket enums by names
Ethan Furman added the comment: Serhiy, sorry for taking so long to get back to this -- we spent so much time making sure pickling worked I had no idea that unpickling didn't work in prior versions. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20680 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20680] Pickle socket enums by names
Ethan Furman added the comment: An IntEnum is just a fancy int. You can add them, subtract them, multiply them, all that kind of thing. If you attempt to unpickle a 3.4 _PickleByNameIntEnum on a 3.3 system, what's going to happen? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20680 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20680] Pickle socket enums by names
Serhiy Storchaka added the comment: If you attempt to unpickle a 3.4 _PickleByNameIntEnum on a 3.3 system, what's going to happen? The same as if you attempt to unpickle a 3.4 IntEnum on a 3.3 system -- AttributeError. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20680 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20680] Pickle socket enums by names
Serhiy Storchaka added the comment: For the socket module constants there is even better way, which supports forward compatibility, i.e. SOCK_STREAM pickled in 3.5 could be unpickled on 3.3 (replacing ints with enums breaks forward compatibility). Here is a patch. -- Added file: http://bugs.python.org/file38048/socket_enums_pickle_by_name_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20680 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20680] Pickle socket enums by names
Serhiy Storchaka added the comment: I don't see how it can break code. If people use workaround that were not broken by changing SOCK_STREAM from int to enum, it shouldn't break by changing pickle representation of SOCK_STREAM. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20680 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20680] Pickle socket enums by names
Ethan Furman added the comment: To make sure I understand correctly: On platform ABC the value 1 could mean SOCK_STREAM but on platform XYZ SOCK_STREAM is value 32? Assuming the need to pickle socket types is not new, then people have been doing it, possibly with painful workarounds, on the integer values until now, and suddenly changing the pickle of a socket type from an integer into a string is going to break code. Or am I missing something? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20680 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20680] Pickle socket enums by names
Changes by Ethan Furman et...@stoneleaf.us: -- assignee: - ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20680 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20680] Pickle socket enums by names
New submission from Serhiy Storchaka: As far as socked enums are platform depending, pickling them by value makes not much sense. Here is a patch which makes AddressFamily and SocketType members be pickled by name. -- components: Library (Lib) files: socket_enums_pickle_by_name.patch keywords: patch messages: 211559 nosy: barry, eli.bendersky, ethan.furman, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Pickle socket enums by names type: behavior versions: Python 3.4, Python 3.5 Added file: http://bugs.python.org/file34140/socket_enums_pickle_by_name.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20680 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com