]>
Commit | Line | Data |
---|---|---|
fb267d52 | 1 | Index: mod_python/lib/python/mod_python/apache.py |
2 | =================================================================== | |
3 | RCS file: /home/devel/CVS/rhn/modules/mod_python/lib/python/mod_python/apache.py,v | |
4 | retrieving revision 1.4 | |
5 | diff -u -r1.4 apache.py | |
6 | --- mod_python/lib/python/mod_python/apache.py 2 Aug 2001 22:52:50 -0000 1.4 | |
7 | +++ mod_python/lib/python/mod_python/apache.py 28 Feb 2002 02:57:53 -0000 | |
8 | @@ -58,10 +58,6 @@ | |
9 | # variable stores the last PythonPath in raw (unevaled) form. | |
10 | _path = None | |
11 | ||
12 | -# this is used in Request.__init__ | |
13 | -def _cleanup_request(_req): | |
14 | - _req._Request = None | |
15 | - | |
16 | class Request: | |
17 | """ This is a normal Python Class that can be subclassed. | |
18 | However, most of its functionality comes from a built-in | |
19 | @@ -73,11 +69,6 @@ | |
20 | # look at __setattr__ if changing this line! | |
21 | self._req = _req | |
22 | ||
23 | - # this will decrement the reference to the _req | |
24 | - # object at cleanup time. If we don't do this, we | |
25 | - # get a cirular reference and _req never gets destroyed. | |
26 | - _req.register_cleanup(_cleanup_request, _req) | |
27 | - | |
28 | def __getattr__(self, attr): | |
29 | try: | |
30 | return getattr(self._req, attr) | |
31 | @@ -129,6 +120,7 @@ | |
32 | ||
33 | # is there a Request object for this request? | |
34 | if not _req._Request: | |
35 | + # warning, creating circular reference here | |
36 | _req._Request = Request(_req) | |
37 | ||
38 | req = _req._Request | |
39 | @@ -239,6 +231,10 @@ | |
40 | htype=htype, hname=handler, debug=debug) | |
41 | finally: | |
42 | exc_traceback = None | |
43 | + | |
44 | + if htype == "PythonCleanupHandler": | |
45 | + # destroy the circular reference | |
46 | + _req._Request = req = None | |
47 | ||
48 | return result | |
49 |