changeset 19726:b3c8c6f2b5c1

parsers: use Py_INCREF safely
author Bryan O'Sullivan <bryano@fb.com>
date Mon, 16 Sep 2013 12:12:37 -0700
parents 5e25d71a58cc
children 3d07b4a2f743
files mercurial/parsers.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/parsers.c	Mon Sep 16 12:10:28 2013 -0700
+++ b/mercurial/parsers.c	Mon Sep 16 12:12:37 2013 -0700
@@ -540,11 +540,12 @@
 			      uncomp_len, base_rev, link_rev,
 			      parent_1, parent_2, c_node_id, 20);
 
-	if (entry)
+	if (entry) {
 		PyObject_GC_UnTrack(entry);
+		Py_INCREF(entry);
+	}
 
 	self->cache[pos] = entry;
-	Py_INCREF(entry);
 
 	return entry;
 }