Mercurial > hg
changeset 24651:67241ee427cf
dirs._addpath: reinstate use of Py_CLEAR
I changed this to an explicit Py_DECREF + set to null in 6f0e6fa9fdd7. This was
a silly misunderstanding on my part -- for some reason I thought Py_CLEAR set
its argument to null only if its refcount reached 0. Turns out that's not
actually the case -- Py_CLEAR is just Py_DECREF + set to null with some
additional precautions around destructors that aren't relevant here.
The real bug that 6f0e6fa9fdd7 fixed was the fact that we were mutating the
string after setting it in the Python dictionary.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Tue, 07 Apr 2015 20:43:04 -0700 |
parents | b83a8f512a80 |
children | 232bf0028596 |
files | mercurial/dirs.c |
diffstat | 1 files changed, 2 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dirs.c Mon Apr 06 18:31:59 2015 -0700 +++ b/mercurial/dirs.c Tue Apr 07 20:43:04 2015 -0700 @@ -94,10 +94,8 @@ goto bail; /* Clear the key out since we've already exposed it to Python - and can't mutate it further. key's refcount is currently 2 so - we can't just use Py_CLEAR. */ - Py_DECREF(key); - key = NULL; + and can't mutate it further. */ + Py_CLEAR(key); } ret = 0;