[issue20534] Enum tests fail with pickle protocol 4

2014-02-08 Thread Roundup Robot
Roundup Robot added the comment: New changeset 9f75f8a2cbb4 by Ethan Furman in branch 'default': Close issue20534: all pickle protocols now supported. http://hg.python.org/cpython/rev/9f75f8a2cbb4 -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed

[issue20534] Enum tests fail with pickle protocol 4

2014-02-08 Thread Ethan Furman
Ethan Furman added the comment: I do not recall if it was or not. The main difference would be in how aliases were handled. For example, if W and Z were the same value on system A, but different on system B, then going from A - B via pickle W and Z would still be the same using the current m

[issue20534] Enum tests fail with pickle protocol 4

2014-02-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I don't know if this was discussed, but as far as enums will be used for platform depending constants (as ENOENT or AF_UNIX), I think that enums should be pickled by name, not by value. Here is the __reduce_ex__ implementation: def __reduce_ex__(self, pr

[issue20534] Enum tests fail with pickle protocol 4

2014-02-08 Thread Ethan Furman
Ethan Furman added the comment: Serhiy commented: - > Actually they don't pickle due to wrong __module__. After adding > >NEI.__module__ = NamedInt.__module__ = __name__ > > PicklingError no longer raised for enum class. If you were to look at the `_make_class_unpicklable`

[issue20534] Enum tests fail with pickle protocol 4

2014-02-08 Thread Ethan Furman
Ethan Furman added the comment: The only thing I hate more than being wrong is being wrong because Python isn't acting the way I think it should. :/ So, __qualname__ is not set properly when using the function API (although it has nothing to do with manually setting __module__ (I removed it,

[issue20534] Enum tests fail with pickle protocol 4

2014-02-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > - > The object class implements both __reduce__() and __reduce_ex__(); > however, if a subclass overrides __reduce__() but not __reduce_ex__(), > the __reduce_ex__() implementation detect

[issue20534] Enum tests fail with pickle protocol 4

2014-02-07 Thread Ethan Furman
Ethan Furman added the comment: Ethan commented: > I left the test for test_subclasses_without_getnewargs alone as the point of > that test is to make sure that _make_class_unpicklable is working properly, > not to see if we can somehow get any of it to pickle. Serhiy replied: -

[issue20534] Enum tests fail with pickle protocol 4

2014-02-07 Thread Ethan Furman
Ethan Furman added the comment: The version 2 docs: http://docs.python.org/2/library/pickle.html#object.__reduce_ex__: - The object class implements both __reduce__() and __reduce_ex__(); however, if a subclass overrides __re

[issue20534] Enum tests fail with pickle protocol 4

2014-02-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Pickle will prefer the __reduce_ex__() method over the __reduce__() method. If base class defined the __reduce_ex__() method, Enum.__reduce__() will be ignored. > I left the test for test_subclasses_without_getnewargs alone as the point of > that test is to

[issue20534] Enum tests fail with pickle protocol 4

2014-02-07 Thread Ethan Furman
Ethan Furman added the comment: I also removed the protocol 2 warning from the docs, and added this note: .. note:: With pickle protocol version 4 it is possible to easily pickle enums nested in other classes. -- ___ Python tracker

[issue20534] Enum tests fail with pickle protocol 4

2014-02-07 Thread Ethan Furman
Ethan Furman added the comment: Okay, I went with __reduce__ since we don't ever use the pickle protocol information. I added a test for class-nested Enums since protocol 4 supports it. I left the test for test_subclasses_without_getnewargs alone as the point of that test is to make sure that

[issue20534] Enum tests fail with pickle protocol 4

2014-02-07 Thread Ethan Furman
Ethan Furman added the comment: Because I didn't know how to make it work with 0 and 1. Thank you! I'll get that in today. -- stage: committed/rejected -> patch review status: closed -> open ___ Python tracker _

[issue20534] Enum tests fail with pickle protocol 4

2014-02-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: But why the minimum supported pickle protocol is 2? Here is a patch which makes enums pickleable with all protocols. -- Added file: http://bugs.python.org/file33952/enum_pickle.patch ___ Python tracker

[issue20534] Enum tests fail with pickle protocol 4

2014-02-06 Thread Roundup Robot
Roundup Robot added the comment: New changeset 35f57ab9389b by Ethan Furman in branch 'default': Close issue20534: test_enum now tests all supported pickle protocols (2 - HIGHEST_PROTOCOL, inclusive). http://hg.python.org/cpython/rev/35f57ab9389b -- nosy: +python-dev resolution: -> fix

[issue20534] Enum tests fail with pickle protocol 4

2014-02-06 Thread Ethan Furman
Ethan Furman added the comment: Serhiy, the minimum supported pickle protocol is 2. Now testing all protocols from 2 to HIGHEST_PROTOCOL, inclusive. -- ___ Python tracker ___ _

[issue20534] Enum tests fail with pickle protocol 4

2014-02-06 Thread Ethan Furman
Ethan Furman added the comment: Thanks, Antoine, that was what I needed. -- assignee: -> ethan.furman keywords: +patch stage: needs patch -> patch review Added file: http://bugs.python.org/file33949/issue20534.stoneleaf.01.patch ___ Python tracker <

[issue20534] Enum tests fail with pickle protocol 4

2014-02-06 Thread Antoine Pitrou
Antoine Pitrou added the comment: Those tracebacks don't correspond to line numbers in the stdlib enum.py. Regardless, the two tests fail understandably: they define a class in the local namespace and then monkeypatch globals() with it, but don't adjust the __qualname__. -- _

[issue20534] Enum tests fail with pickle protocol 4

2014-02-06 Thread Ethan Furman
Ethan Furman added the comment: Working on fixing tests now. Not sure I can fix pickle (at least not in time for RC1). -- ___ Python tracker ___ ___

[issue20534] Enum tests fail with pickle protocol 4

2014-02-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Pickle tests should test all protocols in range(pickle.HIGHEST_PROTOCOL + 1). -- nosy: +serhiy.storchaka ___ Python tracker ___ __

[issue20534] Enum tests fail with pickle protocol 4

2014-02-06 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- stage: test needed -> needs patch ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue20534] Enum tests fail with pickle protocol 4

2014-02-06 Thread Barry A. Warsaw
Changes by Barry A. Warsaw : -- nosy: +barry ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pytho

[issue20534] Enum tests fail with pickle protocol 4

2014-02-06 Thread Ethan Furman
New submission from Ethan Furman: enum34, the Enum backport, specifically uses `protocol=HIGHEST_PROTOCOL`, while the current enum tests just use the default. Running the enum34 test expose an issue with pickle protocol 4: ==