Commit 35f41507 authored by Russell Keith-Magee's avatar Russell Keith-Magee
Browse files

Fixed #13332 -- Corrected the cleanup code in the test client to avoid a...

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.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12964 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent b7b38a41
Loading
Loading
Loading
Loading
+46 −42
Original line number Diff line number Diff line
@@ -221,10 +221,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)
@@ -268,6 +268,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):
        """