[Python-Dev] Pickle, 3.0, and recursion

Aaron Gallagher habnabit at gmail.com
Sat Oct 4 12:47:25 CEST 2008


Hi,

I posted a bug ticket on bugs.python.org, specifically #3119. Link: http://bugs.python.org/issue3119
The original issue is that the default Pickler can exceed the maximum  
recursion depth for structures that are fairly nested. There's a patch  
attached to the ticket that fixes this behavior by using a generator- 
based callstack. Unfortunately, this completely changes the API of  
Pickler.

As far as I know, such major API changes would not be accepted in to  
3.0 at this point. I tried to come up with an alternate version of the  
patch that just added a subclass, but I haven't been able to think of  
a way to do that that doesn't involve a lot of code duplication. It's  
easy to just copy-paste most of Pickler and give it a new name and  
change the API, but that's hardly an optimal solution.

Does anybody else have any thoughts about how this could be better  
implemented? I think this is a decent implementation, but at this  
point, it's too severe of a change. Maybe somebody else has a better  
idea of how this could fit cleanly into the existing Pickler API or  
write a subclass without a lot of messy duplication.


More information about the Python-Dev mailing list