diff --git a/AUTHORS.md b/AUTHORS.md index 5dbf1e1..85812a4 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -73,4 +73,5 @@ - ([@rmadsen-ks](https://github.com/rmadsen-ks)) - ([@stonebig](https://github.com/stonebig)) - ([@testrunner123](https://github.com/testrunner123)) +- ([@DanBarzilian](https://github.com/DanBarzilian)) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad40164..afb2bad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ This document follows the conventions laid out in [Keep a CHANGELOG][]. ### Fixed +- Fix incorrect dereference of wrapper object in tp_repr, which may result in a program crash + ## [2.5.0][] - 2020-06-14 This version improves performance on benchmarks significantly compared to 2.3. diff --git a/src/runtime/classbase.cs b/src/runtime/classbase.cs index 144bac9..43ec6ea 100644 --- a/src/runtime/classbase.cs +++ b/src/runtime/classbase.cs @@ -266,6 +266,7 @@ namespace Python.Runtime //otherwise use the standard object.__repr__(inst) IntPtr args = Runtime.PyTuple_New(1); + Runtime.XIncref(ob); Runtime.PyTuple_SetItem(args, 0, ob); IntPtr reprFunc = Runtime.PyObject_GetAttrString(Runtime.PyBaseObjectType, "__repr__"); var output = Runtime.PyObject_Call(reprFunc, args, IntPtr.Zero);