[pypy-commit] pypy reflex-support: remove forced updates of namespaces and rely on lazy discovery instead

wlav noreply at buildbot.pypy.org
Tue Jun 26 21:15:50 CEST 2012


Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: reflex-support
Changeset: r55837:28538ba5446d
Date: 2012-06-19 16:00 -0700
http://bitbucket.org/pypy/pypy/changeset/28538ba5446d/

Log:	remove forced updates of namespaces and rely on lazy discovery
	instead

diff --git a/pypy/module/cppyy/interp_cppyy.py b/pypy/module/cppyy/interp_cppyy.py
--- a/pypy/module/cppyy/interp_cppyy.py
+++ b/pypy/module/cppyy/interp_cppyy.py
@@ -530,16 +530,11 @@
         datamember = self._make_datamember(dm_name, dm_idx)
         return datamember
 
-    def update(self):
-        self._find_methods()
-        self._find_datamembers()
-
     def is_namespace(self):
         return self.space.w_True
 
 W_CPPNamespace.typedef = TypeDef(
     'CPPNamespace',
-    update = interp2app(W_CPPNamespace.update),
     get_method_names = interp2app(W_CPPNamespace.get_method_names),
     get_overload = interp2app(W_CPPNamespace.get_overload, unwrap_spec=['self', str]),
     get_datamember_names = interp2app(W_CPPNamespace.get_datamember_names),
diff --git a/pypy/module/cppyy/src/cintcwrapper.cxx b/pypy/module/cppyy/src/cintcwrapper.cxx
--- a/pypy/module/cppyy/src/cintcwrapper.cxx
+++ b/pypy/module/cppyy/src/cintcwrapper.cxx
@@ -516,22 +516,15 @@
     if (cr.GetClass() && cr->GetListOfMethods())
         return cr->GetListOfMethods()->GetSize();
     else if (strcmp(cr.GetClassName(), "") == 0) {
-    // NOTE: the updated list of global funcs grows with 5 "G__ateval"'s just
-    // because it is being updated => infinite loop! Apply offset to correct ...
-        static int ateval_offset = 0;
-        TCollection* funcs = gROOT->GetListOfGlobalFunctions(kTRUE);
-        ateval_offset += 5;
-	if (g_globalfuncs.size() <= (GlobalFuncs_t::size_type)funcs->GetSize() - ateval_offset) {
-            g_globalfuncs.clear();
+        if (g_globalfuncs.empty()) {
+            TCollection* funcs = gROOT->GetListOfGlobalFunctions(kTRUE);
 	    g_globalfuncs.reserve(funcs->GetSize());
 
             TIter ifunc(funcs);
 
             TFunction* func = 0;
             while ((func = (TFunction*)ifunc.Next())) {
-                if (strcmp(func->GetName(), "G__ateval") == 0)
-                    ateval_offset += 1;
-                else
+                if (strcmp(func->GetName(), "G__ateval") != 0)
                     g_globalfuncs.push_back(*func);
             }
         }


More information about the pypy-commit mailing list