classification
Title: TracebackException(capture_locals=True) may fail with RecursionError
Type: behavior Stage: resolved
Components: ctypes, Library (Lib) Versions: Python 3.7, Python 3.6, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: Ilya.Kulakov, amaury.forgeotdarc, belopolsky, meador.inge, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2017-01-10 01:43 by Ilya.Kulakov, last changed 2017-03-31 16:36 by dstufft. This issue is now closed.

Files
File name Uploaded Description Edit
ctypes_cdll_uninitialized_repr.patch serhiy.storchaka, 2017-01-10 20:44 review
Pull Requests
URL Status Linked Edit
PR 552 closed dstufft, 2017-03-31 16:36
Messages (5)
msg285084 - (view) Author: Ilya Kulakov (Ilya.Kulakov) * Date: 2017-01-10 01:43
I'm using Python 3.5.2 to be precise. I have code that is roughly equivalent to:

    import sys
    import traceback

    def handle_exception(exc_type, exc_value, exc_traceback):
        traceback.TracebackException(exc_type, exc_value, exc_traceback, capture_locals=True)

    sys.excepthook = handle_exception

For one of the clients the following error happened:

Traceback (most recent call last):
  File "...", line 222, in ...
  File "...", line 160, in ...
  File "...", line 878, in ...
  File ":/traceback.py", line 463, in __init__
  File ":/traceback.py", line 474, in __init__
  File ":/traceback.py", line 352, in extract
  File ":/traceback.py", line 257, in __init__
  File ":/traceback.py", line 257, in <genexpr>
  File ":/ctypes/__init__.py", line 354, in __repr__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
  File ":/ctypes/__init__.py", line 360, in __getattr__
  File ":/ctypes/__init__.py", line 365, in __getitem__
RecursionError: maximum recursion depth exceeded
msg285091 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-01-10 06:07
Could you please provide a script that reproduces an issue?

Seems the repr of uninitialized CDLL instance is used. It causes an infinite recursion in attempt to resolve not set private attributes (_name, _handle, _FuncPtr).
msg285148 - (view) Author: Ilya Kulakov (Ilya.Kulakov) * Date: 2017-01-10 19:38
I was not able to reproduce it.

The origin "unhandeled" exception happens after ctypes.cdll.LoadLibrary fails to load a library:

Traceback (most recent call last):
  File "...", line 852, in ...
  File ":/ctypes/__init__.py", line 425, in LoadLibrary
  File ":/ctypes/__init__.py", line 347, in __init__
OSError: [WinError 126] 找不到指定的模組

Then we raise our own exception.
msg285154 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-01-10 20:44
Proposed patch fixes an infinite recursion in a repr of uninitialized CDLL instance.
msg285366 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2017-01-13 07:44
New changeset d9a64d00a439 by Serhiy Storchaka in branch '3.5':
Issue #29219: Fixed infinite recursion in the repr of uninitialized
https://hg.python.org/cpython/rev/d9a64d00a439

New changeset d9539a5c2315 by Serhiy Storchaka in branch '2.7':
Issue #29219: Fixed infinite recursion in the repr of uninitialized
https://hg.python.org/cpython/rev/d9539a5c2315

New changeset 17ca7c4dd583 by Serhiy Storchaka in branch '3.6':
Issue #29219: Fixed infinite recursion in the repr of uninitialized
https://hg.python.org/cpython/rev/17ca7c4dd583

New changeset 0503024831ad by Serhiy Storchaka in branch 'default':
Issue #29219: Fixed infinite recursion in the repr of uninitialized
https://hg.python.org/cpython/rev/0503024831ad
History
Date User Action Args
2017-03-31 16:36:08dstufftsetpull_requests: + pull_request837
2017-01-13 07:45:51serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-01-13 07:44:51python-devsetnosy: + python-dev
messages: + msg285366
2017-01-13 07:35:09serhiy.storchakasetassignee: serhiy.storchaka
2017-01-10 20:44:16serhiy.storchakasetfiles: + ctypes_cdll_uninitialized_repr.patch
keywords: + patch
messages: + msg285154

stage: patch review
2017-01-10 19:38:20Ilya.Kulakovsetmessages: + msg285148
2017-01-10 06:07:28serhiy.storchakasetversions: + Python 2.7, Python 3.6, Python 3.7
nosy: + amaury.forgeotdarc, meador.inge, serhiy.storchaka, belopolsky

messages: + msg285091

components: + ctypes
type: crash -> behavior
2017-01-10 01:43:30Ilya.Kulakovcreate