Skip to content
This repository was archived by the owner on Sep 14, 2018. It is now read-only.
This repository was archived by the owner on Sep 14, 2018. It is now read-only.

SystemError: Handle is not initialized. in _weakrefset.py still happens #1574

@uvermin

Description

@uvermin

Hello,
I've experienced a problem similar to the one in this closed issue.
I'm using the latest version of IronPython (2.7.7), on a windows10 64 bit.

I'm calling to python from C#, in a multi-threaded environment.
My python code uses a lot of isinstance calls, and some of them (about once every 10,000 times) raise either a "SystemError: Handle is not initialized." or a "ValueError: Index was out of range. Must be non-negative and less than the size of the collection.\nParameter name: index".

By catching the exception in python I was able to locate the source to the same lines in _weakrefset.py, as described here:

On "Lib\_weakrefset.py"

35 :class WeakSet(object):
....
68 :    def __contains__(self, item):
69 :        try:
**70*:           wr = ref(item)      # <- here is raised "ValueError"

Exception ("Index was out of range")

71 :        except TypeError:
72 :            return False
**73*:       return wr in self.data  # <- here is raised "SystemError"

Exception ("Handle is not initialized")

I've tried using the script given in the original issue to recreate the problem, but that didn't work.
The C# code I'm using is open-source, and I don't know C# enough to understand where exactly my python is being called and in what context.
Please, If someone could help me recreate the problem, I will upload a detailed script that raises the same exceptions.
Thanks!

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