[mod_python] What can be pickled?

Graham Dumpleton grahamd at dscpl.com.au
Thu Oct 20 07:21:17 EDT 2005


For background on limitations with what can be pickled in sessions
read:

   http://www.dscpl.com.au/articles/modpython-005.html

Graham

On 20/10/2005, at 8:29 PM, Nicolas Lehuen wrote:

> Hi,
>
> This means that they are not locally defined in a function or class.
>
> In this example, foo is top-level whereas bar isn't :
>
> # mymodule.py
> def foo(y):
>     def bar(x):
>         return x+y
>     return bar
>
> Just as an aside, I suppose you asking this question because you  
> try to store functions or classes in a session object. Just don't  
> do this, this is not supported and won't ever be. There are way too  
> many problems due to the interactions between dynamic module  
> loading and pickling.
>
> Regards,
> Nicolas
>
>
> 2005/10/20, Paul Hide <paul.hide at gmail.com>: Section 3.14.4 of the  
> python language reference manual states:
>
> "These restrictions are why picklable functions and classes must be  
> defined in the top level of a module."
>
> What does the phrase "top level" mean here?
>
> Paul Hide
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>
>
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>



More information about the Mod_python mailing list