Commit 65a9d730 authored by Russell Keith-Magee's avatar Russell Keith-Magee
Browse files

[1.1.X] Fixed #13332 -- Corrected the cleanup code in the test client to avoid...

[1.1.X] Fixed #13332 -- Corrected the cleanup code in the test client to avoid a refcounting problem with signal handlers. This is a fix for the benefit of PyPy's hybrid GC. Thanks to Alex Gaynor for the report and patch.

Backport of r12964 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12965 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent cf08ea49
Loading
Loading
Loading
Loading
+46 −42
Original line number Diff line number Diff line
@@ -216,10 +216,10 @@ class Client(object):
        # callback function.
        data = {}
        on_template_render = curry(store_rendered_templates, data)
        signals.template_rendered.connect(on_template_render)

        signals.template_rendered.connect(on_template_render, dispatch_uid="template-render")
        # Capture exceptions created by the handler.
        got_request_exception.connect(self.store_exc_info)
        got_request_exception.connect(self.store_exc_info, dispatch_uid="request-exception")
        try:

            try:
                response = self.handler(environ)
@@ -263,6 +263,10 @@ class Client(object):
                self.cookies.update(response.cookies)

            return response
        finally:
            signals.template_rendered.disconnect(dispatch_uid="template-render")
            got_request_exception.disconnect(dispatch_uid="request-exception")


    def get(self, path, data={}, follow=False, **extra):
        """