Constructor executed twice when overriding constructor in System.Object. · Issue #495 · pythonnet/pythonnet
Repository navigation
Constructor executed twice when overriding constructor in System.Object. #495
New issue
New issue
Closed
Closed
Constructor executed twice when overriding constructor in System.Object. #495
Description
@klasma's profile klasma opened on Jun 15, 2017Environment
- Pythonnet version: 2.3.0
- Python version: 2.7.13
- Operating System: Windows 10
Details
We are trying to create a subclass of System.Object (using namespace) and override the constructor.
For some reason, the conctructor is executed twice when an instance of the class is created. Below is an example that reproduces the problem.
class X(System.Object):
__namespace__ = "PyTest"
def __init__(self):
print("Running X constructor")
x = X()
The output is
Running X constructor
Running X constructor