[pypy-commit] pypy cling-support: force deserialization of global functions

wlav pypy.commits at gmail.com
Fri Aug 19 14:14:05 EDT 2016


Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: cling-support
Changeset: r86324:741cd54aa263
Date: 2016-08-18 16:40 -0700
http://bitbucket.org/pypy/pypy/changeset/741cd54aa263/

Log:	force deserialization of global functions

diff --git a/pypy/module/cppyy/src/clingcwrapper.cxx b/pypy/module/cppyy/src/clingcwrapper.cxx
--- a/pypy/module/cppyy/src/clingcwrapper.cxx
+++ b/pypy/module/cppyy/src/clingcwrapper.cxx
@@ -716,8 +716,13 @@
 {
    std::vector< TCppMethod_t > methods;
    if ( scope == GLOBAL_HANDLE ) {
+      // TODO: figure out a way of being conservative with reloading
       TCollection* funcs = gROOT->GetListOfGlobalFunctions( kTRUE );
 
+      // tickle deserialization
+      if ( !funcs->FindObject( name.c_str() ) )
+         return methods;
+
       TIter ifunc(funcs);
       TFunction* func = 0;
       while ( (func = (TFunction*)ifunc.Next()) ) {
@@ -1327,6 +1332,11 @@
         }
     } else if (scope == (cppyy_scope_t)GLOBAL_HANDLE) {
         TCollection* funcs = gROOT->GetListOfGlobalFunctions(kTRUE);
+
+        // tickle deserialization
+        if (!funcs->FindObject(name))
+            return (cppyy_index_t*)nullptr;
+
         TFunction* func = 0;
         TIter ifunc(funcs);
         while ((func = (TFunction*)ifunc.Next())) {
@@ -1336,7 +1346,7 @@
     }
 
     if (result.empty())
-        return (cppyy_index_t*)0;
+        return (cppyy_index_t*)nullptr;
 
     cppyy_index_t* llresult = (cppyy_index_t*)malloc(sizeof(cppyy_index_t)*(result.size()+1));
     for (int i = 0; i < (int)result.size(); ++i) llresult[i] = result[i];


More information about the pypy-commit mailing list