Increase ob's ref count in tp_repr to avoid accidental free
This commit is contained in:
Родитель
9fb545ae90
Коммит
742463e580
|
@ -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))
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче