← Winnitude! Search  ·  Reader Mode (1083 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 6 LINKS

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, 2017

Environment

  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions