summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/_internal.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/numpy/core/_internal.py b/numpy/core/_internal.py
index 1cd6cd17f..5fd643505 100644
--- a/numpy/core/_internal.py
+++ b/numpy/core/_internal.py
@@ -278,7 +278,8 @@ class _ctypes(object):
# _ctypes.cast function causes a circular reference of self._data in
# self._data._objects. Attributes of self._data cannot be released
# until gc.collect is called. Make a copy of the pointer first then let
- # it hold the array reference.
+ # it hold the array reference. This is a workaround to circumvent the
+ # CPython bug https://bugs.python.org/issue12836
ptr = self._ctypes.cast(self._data, obj)
ptr._arr = self._arr
return ptr