[Python-checkins] cpython (2.7): Issue #29219: Fixed infinite recursion in the repr of uninitialized

serhiy.storchaka python-checkins at python.org
Fri Jan 13 02:44:48 EST 2017


https://hg.python.org/cpython/rev/d9539a5c2315
changeset:   106128:d9539a5c2315
branch:      2.7
parent:      106105:4ce22d69e134
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Fri Jan 13 09:37:56 2017 +0200
summary:
  Issue #29219: Fixed infinite recursion in the repr of uninitialized
ctypes.CDLL instances.

files:
  Lib/ctypes/__init__.py |  4 ++++
  Misc/NEWS              |  3 +++
  2 files changed, 7 insertions(+), 0 deletions(-)


diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py
--- a/Lib/ctypes/__init__.py
+++ b/Lib/ctypes/__init__.py
@@ -342,6 +342,10 @@
     """
     _func_flags_ = _FUNCFLAG_CDECL
     _func_restype_ = c_int
+    # default values for repr
+    _name = '<uninitialized>'
+    _handle = 0
+    _FuncPtr = None
 
     def __init__(self, name, mode=DEFAULT_MODE, handle=None,
                  use_errno=False,
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -23,6 +23,9 @@
 Library
 -------
 
+- Issue #29219: Fixed infinite recursion in the repr of uninitialized
+  ctypes.CDLL instances.
+
 - Issue #29082: Fixed loading libraries in ctypes by unicode names on Windows.
   Original patch by Chi Hsuan Yen.
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list