Author Claudiu.Popa
Recipients Claudiu.Popa, kbk, loewis, pitrou, ppperry, roger.serwy, serhiy.storchaka, terry.reedy
Date 2014-10-09.21:28:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1412890106.22.0.748015537181.issue21986@psf.upfronthosting.co.za>
In-reply-to
Content
Thank you for your feedback, Terry.

1. IDLE is behaving differently than the builtin interpreter. It should be higher priority, because it
leads beginners into believing that code objects are picklable.

2. No, wrapping code objects in a CodePickler with __getstate__ et al will not work. What is important in my implementation of CodePickler is that the dispatch_table is private, so it will not leak private reduction function, as it happens right now.

3. That doesn't make sense. What works now is pickling of code objects, removing the copyreg call, without my patch, will break the rpc as well. To test this, comment the copyreg.pickle call in idlelib.rpc and just define a function in IDLE, you'll get a PicklingError. I added a small test file, which can be used to test what happens now and what happens after my patch.

4. Better, here's a traceback which can explain from where codes are sent. The traceback is from inside pickle_code, using code.InteractiveInterpreter.

 File "C:\Python34\lib\idlelib\PyShell.py", line 1602, in main
   root.mainloop()
 File "C:\Python34\lib\tkinter\__init__.py", line 1069, in mainloop
   self.tk.mainloop(n)
 File "C:\Python34\lib\tkinter\__init__.py", line 1487, in __call__
   return self.func(*args)
 File "C:\Python34\lib\idlelib\MultiCall.py", line 179, in handler
   r = l[i](event)
 File "C:\Python34\lib\idlelib\PyShell.py", line 1188, in enter_callback
   self.runit()
 File "C:\Python34\lib\idlelib\PyShell.py", line 1229, in runit
   more = self.interp.runsource(line)
 File "C:\Python34\lib\idlelib\PyShell.py", line 671, in runsource
   return InteractiveInterpreter.runsource(self, source, filename)
 File "C:\Python34\lib\code.py", line 74, in runsource
   self.runcode(code)
 File "C:\Python34\lib\idlelib\PyShell.py", line 762, in runcode
   (code,), {})
 File "C:\Python34\lib\idlelib\rpc.py", line 256, in asyncqueue
   self.putmessage((seq, request))
 File "C:\Python34\lib\idlelib\rpc.py", line 348, in putmessage
   s = pickle.dumps(message)
History
Date User Action Args
2014-10-09 21:28:26Claudiu.Popasetrecipients: + Claudiu.Popa, loewis, terry.reedy, kbk, pitrou, roger.serwy, serhiy.storchaka, ppperry
2014-10-09 21:28:26Claudiu.Popasetmessageid: <1412890106.22.0.748015537181.issue21986@psf.upfronthosting.co.za>
2014-10-09 21:28:26Claudiu.Popalinkissue21986 messages
2014-10-09 21:28:25Claudiu.Popacreate