#1566 Creating a lock now uses python built-in "open()" method to work arou… by HageMaster3108 · Pull Request #1619 · gitpython-developers/GitPython (original) (raw)

You know what, I have a feeling that what I said above would be right if this implementation of a lock wasn't racy. After all, it first checks for the lock with has_lock() and then it tries to acquire it. The EXCL mode was supposed to protect from multiple writers at the same time, but the close_fd part nearly completely removes this protection.

Probably the close_fd was added later as having a million file-handles open causes problems as well.

With that said, I think the implementation basically has been broken for a long time now, and the new implementation here does not make it worse. Instead, it increases compatibility so it's definitely a win.

Oh dear 😅.