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
17using 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}
#define Py_RETURN_NONE
Definition: CPyCppyy.h:281
_object PyObject
Definition: PyMethodBase.h:41
bool CPPOverload_Check(T *object)
Definition: CPPOverload.h:79
PyObject * AddFileOpenPyz(PyObject *self, PyObject *args)
Make TFile::Open equivalent to a constructor.
Definition: TFilePyz.cxx:23