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

Mark Hammond skippy.hammond at gmail.com
Mon Aug 24 11:10:51 CEST 2015


On 13/08/2015 8:20 PM, Nick Czeczulin wrote:
> 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?

At face value it looks wrong, but I'm not sure without more digging what 
the correct fix is, or why all other SWIG-based types don't have the 
same issue. I'm getting to most of your other issues on SourceForge and 
I suspect I wont find time to dig deeper on this before I make another 
release as the consequences of this seem fairly small (I'm sure None has 
many reference leaks :)

Cheers,

Mark
>
> 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;
>
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> https://mail.python.org/mailman/listinfo/python-win32
>



More information about the python-win32 mailing list