This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Vlastimil.Zíma
Recipients Vlastimil.Zíma
Date 2014-02-28.09:22:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1393579357.22.0.503856996983.issue20804@psf.upfronthosting.co.za>
In-reply-to
Content
Sentinels lose their identity when they are pickled, meaning they are no longer equal to sentinel with the same name.


>>> from mock import sentinel
>>> import pickle
>>> sentinel.foo == sentinel.foo
True
>>> pickle.loads(pickle.dumps(sentinel.foo)) == sentinel.foo
False


I found this bug using Python 2.7.3 and python-mock 1.0.1. Since mock 1.0 is part of Python 3.3 and 3.4 it affects these versions (tested in 3.3.3).

This behavior is tricky to find out if encountered in tests and sentinels can not be used in tests of code which uses pickle and possibly other serializations.
History
Date User Action Args
2014-02-28 09:22:37Vlastimil.Zímasetrecipients: + Vlastimil.Zíma
2014-02-28 09:22:37Vlastimil.Zímasetmessageid: <1393579357.22.0.503856996983.issue20804@psf.upfronthosting.co.za>
2014-02-28 09:22:37Vlastimil.Zímalinkissue20804 messages
2014-02-28 09:22:36Vlastimil.Zímacreate