Found a bug in python scrip

Hello everyone. It’s been a long time, but I found a bug a really really really time ago. I’ve work around it for a long time, but still bug me once in a while.

The error comes inside the threading.py code on line 612. The release is releasing unlock lock. This wont happen on normal code, but if code is written in a way that it stresses this area of code it can release on already ending threads.

Fix:
pastebin.com/CGfJi9rd

Edited lines:
156:

    def locked(self):
        return self.__owner == _get_ident()

194:

        self.locked = lock.locked

612:

        if self.__block.locked():
            self.__block.release()