diff --git a/django/test/client.py b/django/test/client.py
index 63ad1c1..551dce1 100644
--- a/django/test/client.py
+++ b/django/test/client.py
@@ -3,6 +3,7 @@ from urlparse import urlparse, urlunparse, urlsplit
 import sys
 import os
 import re
+import copy
 try:
     from cStringIO import StringIO
 except ImportError:
@@ -89,7 +90,9 @@ def store_rendered_templates(store, signal, sender, template, context, **kwargs)
     Stores templates and contexts that are rendered.
     """
     store.setdefault('template', []).append(template)
-    store.setdefault('context', ContextList()).append(context)
+    context_clone = copy.copy(context)
+    context_clone.dicts = [d.copy() for d in context.dicts]
+    store.setdefault('context', ContextList()).append(context_clone)
 
 def encode_multipart(boundary, data):
     """
diff --git a/tests/regressiontests/test_client_regress/models.py b/tests/regressiontests/test_client_regress/models.py
index 58693cc..ce12496 100644
--- a/tests/regressiontests/test_client_regress/models.py
+++ b/tests/regressiontests/test_client_regress/models.py
@@ -9,7 +9,7 @@ from django.test import Client, TestCase
 from django.test.utils import ContextList
 from django.core.urlresolvers import reverse
 from django.core.exceptions import SuspiciousOperation
-from django.template import TemplateDoesNotExist, TemplateSyntaxError, Context
+from django.template import TemplateDoesNotExist, TemplateSyntaxError, Context, Template
 
 class AssertContainsTests(TestCase):
     def setUp(self):
@@ -498,6 +498,35 @@ class ContextTests(TestCase):
         self.assertEqual(response.context['request-foo'], 'whiz')
         self.assertEqual(response.context['data'], 'bacon')
 
+    def test_subcontext(self):
+        "Context variables can be retrieved from subcontexts"
+        response = self.client.get('/test_client_regress/subcontext/', data={'supervar': 1, 'value_for_subvar': 2})
+        self.assertEqual(len(response.context), 2)
+        self.assertEqual(response.context['supervar'], u'1')
+        self.assertEqual(response.context['subvar'], u'2')
+
+    def test_subcontext_direct(self):
+        "Context variables retrieved from subcontexts can be accessed separately"
+        response = self.client.get('/test_client_regress/subcontext/', data={'supervar': 1, 'value_for_subvar': 2})
+
+        # context for the supertemplate: subcontext not yet set
+        self.assertEqual(response.context[0]['supervar'], u'1')
+        self.assertFalse('subvar' in response.context[0])
+
+        # context for the subtemplate: subcontext has been set
+        self.assertEqual(response.context[1]['supervar'], u'1')
+        self.assertEqual(response.context[1]['subvar'], u'2')
+
+    def test_template_in_context(self):
+        """Context variables with complex data can be retrieved
+
+        The test client must be able to collect contexts which contain
+        e.g. compiled templates as variable values.
+        """
+        response = self.client.get('/test_client_regress/template_in_context/')
+        self.assertEqual([c.keys() for c in response.context], [['testvar']])
+        self.assertTrue(isinstance(response.context['testvar'], Template))
+
 class SessionTests(TestCase):
     fixtures = ['testdata.json']
 
diff --git a/tests/regressiontests/test_client_regress/urls.py b/tests/regressiontests/test_client_regress/urls.py
index 99eb7b7..d5977d6 100644
--- a/tests/regressiontests/test_client_regress/urls.py
+++ b/tests/regressiontests/test_client_regress/urls.py
@@ -24,4 +24,6 @@ urlpatterns = patterns('',
     (r'^request_methods/$', views.request_methods_view),
     (r'^check_unicode/$', views.return_unicode),
     (r'^parse_unicode_json/$', views.return_json_file),
+    (r'^subcontext/$', views.view_with_subcontext),
+    (r'^template_in_context/$', views.view_with_template_in_context),
 )
diff --git a/tests/regressiontests/test_client_regress/views.py b/tests/regressiontests/test_client_regress/views.py
index 5ba7cc3..42cb581 100644
--- a/tests/regressiontests/test_client_regress/views.py
+++ b/tests/regressiontests/test_client_regress/views.py
@@ -3,6 +3,7 @@ from django.contrib.auth.decorators import login_required
 from django.http import HttpResponse, HttpResponseRedirect
 from django.core.exceptions import SuspiciousOperation
 from django.shortcuts import render_to_response
+from django.template import Template, RequestContext
 from django.utils import simplejson
 from django.utils.encoding import smart_str
 from django.core.serializers.json import DjangoJSONEncoder
@@ -86,3 +87,25 @@ def return_json_file(request):
                             mimetype='application/json; charset=' + charset)
     response['Content-Disposition'] = 'attachment; filename=testfile.json'
     return response
+
+def view_with_subcontext(request):
+    """A view that augments the context when including a sub-template
+
+    The purpose of this view is to check that the test client
+    correctly catches context variables from sub-contexts.  This
+    happens when a sub-template is rendered with a context modified or
+    created by a template tag.
+    """
+    return render_to_response("testclient/super.html",
+                              {'supervar': request.GET['supervar'],
+                               'value_for_subvar': request.GET['value_for_subvar']})
+
+def view_with_template_in_context(request):
+    """A view that renders a template with a Template object in the context
+
+    The purpose of this view is to check that complex data in the
+    context doesn't cause errors when the test client collects
+    contexts used for rendering templates.
+    """
+    return render_to_response("base.html",
+                              {'testvar': Template("{% cycle 'a' 'b' %}")})
diff --git a/tests/templates/testclient/sub.html b/tests/templates/testclient/sub.html
new file mode 100644
index 0000000..bb4cad6
--- /dev/null
+++ b/tests/templates/testclient/sub.html
@@ -0,0 +1,2 @@
+{{ subvar }}
+
diff --git a/tests/templates/testclient/super.html b/tests/templates/testclient/super.html
new file mode 100644
index 0000000..998fb0c
--- /dev/null
+++ b/tests/templates/testclient/super.html
@@ -0,0 +1,2 @@
+Value of supervar: {{ supervar }}
+Value of subvar: {% with value_for_subvar as subvar %}{% include "testclient/sub.html" %}{% endwith %}
