[python-win32] PyIMAPIProp.GetPropList() and Py_None ref count

Nick Czeczulin nick at packetfrenzy.com
Thu Aug 13 12:20:25 CEST 2015


I noticed that every call to PyIMAPIProp.GetPropList() causes the ref count for Py_None to increase by one. Can someone comment on whether the following patch seems correct, or if more might be needed?

Thanks,
-nick

--- a/com/win32comext/mapi/src/mapilib.i
+++ b/com/win32comext/mapi/src/mapilib.i
@@ -501,6 +501,8 @@
 }

 %typemap(python,argout) SPropTagArray **OUTPUT {
+ if ($target == Py_None)
+  Py_DECREF($target);
  $target = PyMAPIObject_FromSPropTagArray(*$source);
  if ($target==NULL) {
   $cleanup;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20150813/f833d150/attachment.html>


More information about the python-win32 mailing list