Logo ROOT  
Reference Guide
TFilePyz.cxx
Go to the documentation of this file.
1 // Author: Danilo Piparo CERN 08/2018
2 // Original PyROOT code by Wim Lavrijsen, LBL
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2018, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #include "CPyCppyy.h"
13 #include "CPPOverload.h"
14 #include "PyROOTPythonize.h"
15 #include "Python.h"
16 
17 using namespace CPyCppyy;
18 
19 ////////////////////////////////////////////////////////////////////////////
20 /// \brief Make TFile::Open equivalent to a constructor
21 /// \param[in] self Always null, since this is a module function.
22 /// \param[in] args Pointer to a Python tuple object containing the arguments
24 {
25  PyObject *pyclass = PyTuple_GetItem(args, 0);
26  // TFile::Open really is a constructor
27  PyObject *attr = PyObject_GetAttrString(pyclass, (char *)"Open");
28  if (CPPOverload_Check(attr)) {
29  ((CPPOverload *)attr)->fMethodInfo->fFlags |= CallContext::kIsCreator;
30  }
31  Py_XDECREF(attr);
33 }
CPyCppyy
Set of helper functions that are invoked from the pythonizors, on the Python side.
Definition: TPyClassGenerator.cxx:31
PyObject
_object PyObject
Definition: PyMethodBase.h:42
PyROOTPythonize.h
CPyCppyy::CPPOverload_Check
bool CPPOverload_Check(T *object)
Definition: CPPOverload.h:79
CPyCppyy::CallContext::kIsCreator
@ kIsCreator
Definition: CallContext.h:54
PyROOT::AddFileOpenPyz
PyObject * AddFileOpenPyz(PyObject *self, PyObject *args)
Make TFile::Open equivalent to a constructor.
Definition: TFilePyz.cxx:23
CPyCppyy.h
CPPOverload.h
CPyCppyy::CPPOverload
Definition: CPPOverload.h:36
Py_RETURN_NONE
#define Py_RETURN_NONE
Definition: CPyCppyy.h:281