Skip to content

Commit 7a7e04e

Browse files
Issue python#29219: Fixed infinite recursion in the repr of uninitialized
ctypes.CDLL instances.
1 parent 99ba17f commit 7a7e04e

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Lib/ctypes/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,10 @@ class CDLL(object):
342342
"""
343343
_func_flags_ = _FUNCFLAG_CDECL
344344
_func_restype_ = c_int
345+
# default values for repr
346+
_name = '<uninitialized>'
347+
_handle = 0
348+
_FuncPtr = None
345349

346350
def __init__(self, name, mode=DEFAULT_MODE, handle=None,
347351
use_errno=False,

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ Extension Modules
2323
Library
2424
-------
2525

26+
- Issue #29219: Fixed infinite recursion in the repr of uninitialized
27+
ctypes.CDLL instances.
28+
2629
- Issue #29082: Fixed loading libraries in ctypes by unicode names on Windows.
2730
Original patch by Chi Hsuan Yen.
2831

0 commit comments

Comments
 (0)