New submission from Joseph Fall:

This report is to re-raise an old issue from 2009:
http://bugs.python.org/issue5370
Although that issue is marked as "fixed", I disagree that it was ever "fixed", 
and spent an evil day tracking it down. 

Use Case:
- take two 3rd party packages: django and django-crispy-forms
- django, deep in its inner-workings, uses Pickle
- django-cripsy-forms implements the _getattr__ method in one of it's classes
- when you put the two together such that django pickles a form, the python 
interpreter goes into a tailspin in very sinister and hard-to-track-down ways 
(different behaviour in 2.5, 2.6, 2.7, as noted in issue5370, which includes a 
simple test case)

The "resolution" for issue5370 was to add some documentation to Pickle.  But I 
would argue this is insufficient - the implementer of django-crispy-forms would 
have no reason to ever look at the Pickle docs, and so is very likely to 
implement this bug (which s/he did).

Perhaps, if this issue cannot be resolved in code, as suggested by gagenellina 
back in 2009, at least some documentation could be added to __getattr__ (and 
others) warning that these methods could potentially be called before __init__ 
(similar to the documentation added to Pickle)?  I'd be happy to draft a small 
bit of documentation for this, although if someone can think of a way to simply 
resolve this in Pickle so it does not cause the issue in the first place, that 
seems to me ideal.

A test case is included with issue5370

----------
assignee: docs@python
components: Documentation, Library (Lib)
messages: 172993
nosy: docs@python, powderflask
priority: normal
severity: normal
status: open
title: Pickle and __getattr__
type: behavior
versions: Python 2.6, Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16242>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to