Skip to content

Thread support check is broken under Python 3 #289

@li-dan

Description

@li-dan

ldap/__init__.py checks for thread support by trying to import thread:

try:
  # Check if Python installation was build with thread support
  import thread
except ImportError:
  LDAPLockBaseClass = DummyLock
else:
  import threading
  LDAPLockBaseClass = threading.Lock

The thread module was renamed to _thread in Python 3, so the import always fails.

It would probably be correct to just try importing threading in order to check for thread support. On Python 2, importing threading also imports thread, so there's no difference: https://github.com/python/cpython/blob/2.7/Lib/threading.py

(As an aside, Python 3.7 dropped support for builds without threads: https://bugs.python.org/issue31370.)

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy