<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -352,20 +352,25 @@ class Model(object):
         only module-level classes can be pickled by the default path.
         &quot;&quot;&quot;
         data = self.__dict__
-        if not self._deferred:
-            return super(Model, self).__reduce__()
+        model = self.__class__
+        # The obvious thing to do here is to invoke super().__reduce__()
+        # for the non-deferred case. Don't do that.
+        # On Python 2.4, there is something wierd with __reduce__,
+        # and as a result, the super call will cause an infinite recursion.
+        # See #10547 and #12121.
         defers = []
         pk_val = None
-        for field in self._meta.fields:
-            if isinstance(self.__class__.__dict__.get(field.attname),
-                    DeferredAttribute):
-                defers.append(field.attname)
-                if pk_val is None:
-                    # The pk_val and model values are the same for all
-                    # DeferredAttribute classes, so we only need to do this
-                    # once.
-                    obj = self.__class__.__dict__[field.attname]
-                    model = obj.model_ref()
+        if self._deferred:
+            for field in self._meta.fields:
+                if isinstance(self.__class__.__dict__.get(field.attname),
+                        DeferredAttribute):
+                    defers.append(field.attname)
+                    if pk_val is None:
+                        # The pk_val and model values are the same for all
+                        # DeferredAttribute classes, so we only need to do this
+                        # once.
+                        obj = self.__class__.__dict__[field.attname]
+                        model = obj.model_ref()
 
         return (model_unpickle, (model, defers), data)
 </diff>
      <filename>django/db/models/base.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f9a4e94d003fd925e29a72dcec5d24acb6f58b87</id>
    </parent>
  </parents>
  <author>
    <name>Russell Keith-Magee</name>
    <email>freakboy3742@gmail.com</email>
  </author>
  <url>http://github.com/brosner/django/commit/a5f5051fa1e7aaf8eafcea5fe67479817e1d4090</url>
  <id>a5f5051fa1e7aaf8eafcea5fe67479817e1d4090</id>
  <committed-date>2009-10-31T20:04:20-07:00</committed-date>
  <authored-date>2009-10-31T20:04:20-07:00</authored-date>
  <message>Fixed #12121 -- Modified __reduce__ on a model to avoid an infinite recursion problem that occurs on Python 2.4. Thanks to emulbreh for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11691 bcc190cf-cafb-0310-a4f2-bffc1f526a37</message>
  <tree>98f78af6f38b78b34e25877ac19c8eee99990527</tree>
  <committer>
    <name>Russell Keith-Magee</name>
    <email>freakboy3742@gmail.com</email>
  </committer>
</commit>
