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 serhiy.storchaka
Recipients Arfrever, alexandre.vassalotti, barry, josh.r, kitterma, nadeem.vawda, pitrou, python-dev, serhiy.storchaka
Date 2016-01-11.19:20:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The classes can't be *correctly* copied and unpickled because the pickle data doesn't contain object's state. "Copied" and "unpickled" objects are not equal to original objects, they are non-initialized instances. You can test attributes of copied NameAssignment instance to ensure that they are not restored. May be copied values are not used in Cython building, except rare exclusive cases when using them fails.

Example in the stdlib is csv.Dialect objects:

>>> import csv, pickle
>>> d = csv.get_dialect('excel-tab')
>>> d2 = pickle.loads(pickle.dumps(d))
>>> d.delimiter, d.doublequote, d.escapechar, d.lineterminator, d.quotechar, d.quoting, d.skipinitialspace, d.strict
('\t', 1, None, '\r\n', '"', 0, 0, 0)
>>> d2.delimiter, d2.doublequote, d2.escapechar, d2.lineterminator, d2.quotechar, d2.quoting, d2.skipinitialspace, d2.strict
(',', 1, None, '\r\n', '"', 0, 0, 0)

You just silently get wrong result. Since it by accident matches the instance of most used 'excel' dialect, this error is left unnoticed.

I think we have to left this restriction in 3.6 (and Cython should fix its bug by providing either __getnewargs__/ __getnewargs_ex__, __getstate__ or __reduce__/__reduce_ex__). But in 2.7 and 3.5 we should allow current Cython to work (even obtaining wrong result) by removing the check at all or by making it emit only a warning.
Date User Action Args
2016-01-11 19:20:49serhiy.storchakasetrecipients: + serhiy.storchaka, barry, pitrou, alexandre.vassalotti, nadeem.vawda, Arfrever, kitterma, python-dev, josh.r
2016-01-11 19:20:49serhiy.storchakasetmessageid: <>
2016-01-11 19:20:49serhiy.storchakalinkissue22995 messages
2016-01-11 19:20:49serhiy.storchakacreate