You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-commits@quetz.apache.org by nl...@apache.org on 2005/04/27 09:32:04 UTC

svn commit: r164956 - in /httpd/mod_python/trunk: lib/python/mod_python/psp.py src/_pspmodule.c

Author: nlehuen
Date: Wed Apr 27 00:32:02 2005
New Revision: 164956

URL: http://svn.apache.org/viewcvs?rev=164956&view=rev
Log:
Graham's fix for MODPYTHON-48.

Modified:
    httpd/mod_python/trunk/lib/python/mod_python/psp.py
    httpd/mod_python/trunk/src/_pspmodule.c

Modified: httpd/mod_python/trunk/lib/python/mod_python/psp.py
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/lib/python/mod_python/psp.py?rev=164956&r1=164955&r2=164956&view=diff
==============================================================================
--- httpd/mod_python/trunk/lib/python/mod_python/psp.py (original)
+++ httpd/mod_python/trunk/lib/python/mod_python/psp.py Wed Apr 27 00:32:02 2005
@@ -111,12 +111,14 @@
             self.load_from_file()
         else:
 
-            cached = strcache.get(string)
+            cached = mem_scache.get(string)
             if cached:
                 self.code = cached
             else:
-                self.code = _psp.parsestring(string)
-                strcache.store(string)
+                source = _psp.parsestring(string)
+                code = compile(source, "__psp__", "exec")
+                mem_scache.store(string,code)
+                self.code = code
 
     def cache_get(self, filename, mtime):
 
@@ -358,8 +360,8 @@
 
     def get(self, key):
         if self.cache.has_key(key):
-            hist, val = self.cache[key]
-            self.cache[key] = (hits+1, code)
+            hits, val = self.cache[key]
+            self.cache[key] = (hits+1, val)
             return val
         else:
             return None

Modified: httpd/mod_python/trunk/src/_pspmodule.c
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/src/_pspmodule.c?rev=164956&r1=164955&r2=164956&view=diff
==============================================================================
--- httpd/mod_python/trunk/src/_pspmodule.c (original)
+++ httpd/mod_python/trunk/src/_pspmodule.c Wed Apr 27 00:32:02 2005
@@ -146,7 +146,7 @@
     bs = yy_scan_string(PyString_AsString(str), scanner);
     yylex(scanner);
 
-    yy_delete_buffer(bs, scanner);
+    /* yy_delete_buffer(bs, scanner); */
     yylex_destroy(scanner);
     
     psp_string_0(&parser->pycode);