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.

classification
Title: pickle.whichmodule(object.__new__, None) = 'email.MIMEAudio'
Type: Stage: resolved
Components: XML Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: canjobear, serhiy.storchaka
Priority: normal Keywords:

Created on 2016-03-09 19:06 by canjobear, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg261465 - (view) Author: Richard Futrell (canjobear) Date: 2016-03-09 19:06
On Python 2.7.11, pickle.whichmodule(object.__new__, None) = 'email.MIMEAudio'

This is unlikely to be the correct module.
msg261469 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-03-09 19:56
I get other result:

>>> import pickle
>>> pickle.whichmodule(object.__new__, None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/serhiy/py/cpython2.7/Lib/pickle.py", line 823, in whichmodule
    if name != '__main__' and getattr(module, funcname, None) is func:
TypeError: getattr(): attribute name must be string

Could you please provide the full example?
msg261471 - (view) Author: Richard Futrell (canjobear) Date: 2016-03-09 20:10
Ah, I get the same result as you in a clean interpreter session. Looks like it's not Python's fault.

The bug seems to arise from an interaction with cloudpickle 0.2.1 (and only in IPython), which puts the bad value into a cache somewhere in the pickle module.

So I'll take this issue to cloudpickle. 



In [1]: import cloudpickle

In [2]: cloudpickle.dumps(object.__new__)
Out[2]: '\x80\x02cemail.MIMEAudio\n__new__\nq\x00.'

In [3]: import pickle

In [4]: pickle.whichmodule(object.__new__, None)
Out[4]: 'email.MIMEAudio'
History
Date User Action Args
2022-04-11 14:58:28adminsetgithub: 70709
2016-03-09 21:30:13serhiy.storchakasetstatus: open -> closed
stage: resolved
2016-03-09 20:10:03canjobearsetresolution: not a bug
messages: + msg261471
2016-03-09 19:56:19serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg261469
2016-03-09 19:06:43canjobearcreate