Author: mtredinnick
Date: 2009-03-19 20:37:11 -0500 (Thu, 19 Mar 2009)
New Revision: 10099

Modified:
   django/trunk/django/db/models/base.py
   django/trunk/tests/regressiontests/queries/models.py
Log:
Fixed #10547 -- Worked around some odd behaviour in Python 2.3 and 2.4.

Calling the super() version of __reduce__ in Model.__reduce__ led to infinite
loops in Python prior to 2.5. We don't do that any longer.

Modified: django/trunk/django/db/models/base.py
===================================================================
--- django/trunk/django/db/models/base.py       2009-03-20 00:58:35 UTC (rev 
10098)
+++ django/trunk/django/db/models/base.py       2009-03-20 01:37:11 UTC (rev 
10099)
@@ -348,9 +348,9 @@
         need to do things manually, as they're dynamically created classes and
         only module-level classes can be pickled by the default path.
         """
+        data = self.__dict__
         if not self._deferred:
-            return super(Model, self).__reduce__()
-        data = self.__dict__
+            return (self.__class__, (), data)
         defers = []
         pk_val = None
         for field in self._meta.fields:

Modified: django/trunk/tests/regressiontests/queries/models.py
===================================================================
--- django/trunk/tests/regressiontests/queries/models.py        2009-03-20 
00:58:35 UTC (rev 10098)
+++ django/trunk/tests/regressiontests/queries/models.py        2009-03-20 
01:37:11 UTC (rev 10099)
@@ -895,6 +895,9 @@
 >>> q2 = pickle.loads(pickle.dumps(qs))
 >>> list(qs) == list(q2)
 True
+>>> q3 = pickle.loads(pickle.dumps(qs, pickle.HIGHEST_PROTOCOL))
+>>> list(qs) == list(q3)
+True
 
 Bug #7277
 >>> n1.annotation_set.filter(Q(tag=t5) | Q(tag__children=t5) | 
 >>> Q(tag__children__children=t5))


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to