File tree Expand file tree Collapse file tree
bindings/pyroot/pythonizations/python/ROOT/_pythonization Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77# For the licensing terms see $ROOTSYS/LICENSE. #
88# For the list of contributors see $ROOTSYS/README/CREDITS. #
99################################################################################
10+
11+ import functools
12+
1013from . import pythonization
1114
1215
13- def _TColor_constructor (self , * args , ** kwargs ):
14- """
15- Forward the arguments to the C++ constructor and retain ownership. This
16- helps avoiding double deletes due to ROOT automatic memory management.
17- """
18- self ._cpp_constructor (* args , ** kwargs )
19- import ROOT
20- ROOT .SetOwnership (self , False )
16+ def _tcolor_constructor (original_init ):
17+ @functools .wraps (original_init )
18+ def wrapper (self , * args , ** kwargs ):
19+ original_init (self , * args , ** kwargs )
20+ import ROOT
21+
22+ ROOT .SetOwnership (self , False )
23+
24+ return wrapper
2125
2226
2327@pythonization ("TColor" )
2428def pythonize_tcolor (klass ):
25- klass ._cpp_constructor = klass .__init__
26- klass .__init__ = _TColor_constructor
29+ klass .__init__ = _tcolor_constructor (klass .__init__ )
You can’t perform that action at this time.
0 commit comments