Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7176809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:35:02+00:00 2026-05-28T16:35:02+00:00

I have some IronPython code that is creating a Mutex using the following constructor:

  • 0

I have some IronPython code that is creating a Mutex using the following constructor:

public Mutex(
    bool initiallyOwned,
    string name,
    out bool createdNew
)

Since the last parameter is an out parameter you do not pass it to the method and instead it becomes an extra return value like this:

mutex, sucess = Mutex(True, 'some_mutex')  

When this code runs it throws a TypeError saying that the Mutex object is not iterable. Since it is only returning one value this leads me to believe that IronPython is not choosing the correct overload. The Ironpython documentation says that you can control the exact overload that gets called by using the Overloads method on method objects.

The following bit of code attempts that, however, I get a ValueError stating that the index was out of range:

new_mutex = Mutex.__new__.Overloads[type(True), String, type(True)]
mutex, sucess = new_mutex(Mutex, True, 'some_mutex') 

If I try using the Overloads attribute to force using a different overload it executes correctly. Anyone know where I’m going wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T16:35:04+00:00Added an answer on May 28, 2026 at 4:35 pm

    You could explicitly pass the out bool to the constructor like this:

    success = clr.Reference[bool]()
    mutex = Mutex(True, 'some_mutex', success)
    
    # success.Value is your bool result
    

    That lets the overload resolution stuff just do its thing.

    I’m not quite sure how to extract the right method from __new__.Overloads, but there has to be a way. If I just say Mutex.__new__.Overloads, it shows me a list that includes the overload that you’re looking for.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code that has to compile for multiple platforms. The following will
I have some IronPython code which makes use of XmlTextWriter which allows me to
I have some old python code that uses the pywin32 extensions. Starting out with
I have some IronPython scripts that are embedded in a C# project, and it
I have some class file.h where public: bool frameSendingFinished; is defined. So in class
Have some Perl code which is using the DBI module - (the code is
Have some JavaScript that assigns values to an object using $.data and then uses
I have some perl code that looks something like this: my @array = map
I have the following IronPython code. class Hello: def __init__(self): pass def add(self, x,
I have the following IronPython code. class Hello: def __init__(self): pass def add(self, x,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.