Menu

#14 Python 3.12 support - cdll.ktoblzcheck now raises AttributeError

1.54
closed
nobody
1.53 (10)
2024-01-05
2023-12-20
Michael Cho
No

In Python 3.12, it looks like cdll.ktoblzcheck will raise AttributeError:

Python 3.12.0 (main, Oct  4 2023, 06:27:34) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes import cdll; cdll.ktoblzcheck
Traceback (most recent call last):
  File "/usr/lib/python3.12/ctypes/__init__.py", line 450, in __getattr__
    dll = self._dlltype(name)
          ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/ctypes/__init__.py", line 379, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: ktoblzcheck: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.12/ctypes/__init__.py", line 452, in __getattr__
    raise AttributeError(name)
AttributeError: ktoblzcheck

Since current code only handles OSError, it will cause Python code to exit rather than fallback to cdll['libktoblzcheck.so.1']

Discussion

  • Ralf Habacker

    Ralf Habacker - 2023-12-20

    Thank you for reporting this problem. If you already have a solution to the problem, please open a merge request with a patch to fix the problem.

     
  • Ralf Habacker

    Ralf Habacker - 2024-01-05
    • labels: 1.54 --> 1.53
    • Version: 1.53 --> 1.54
     

Log in to post a comment.

MongoDB Logo MongoDB