Patchwork [1,of,3] cext: move back finalization of dirstateTupleType where it should be

login
register
mail settings
Submitter Yuya Nishihara
Date May 21, 2017, 6:02 a.m.
Message ID <429ef6c0fa3c16ff776c.1495346522@mimosa>
Download mbox | patch
Permalink /patch/20781/
State Accepted
Headers show

Comments

Yuya Nishihara - May 21, 2017, 6:02 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1495341087 -32400
#      Sun May 21 13:31:27 2017 +0900
# Node ID 429ef6c0fa3c16ff776cd6aeff27d2f27c2fc7d3
# Parent  b9942bc6b292aa9b16ad80fceb765dab4f1c777c
cext: move back finalization of dirstateTupleType where it should be

Patch

diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c
--- a/mercurial/cext/parsers.c
+++ b/mercurial/cext/parsers.c
@@ -944,6 +944,8 @@  static void module_init(PyObject *mod)
 	manifest_module_init(mod);
 	revlog_module_init(mod);
 
+	if (PyType_Ready(&dirstateTupleType) < 0)
+		return;
 	Py_INCREF(&dirstateTupleType);
 	PyModule_AddObject(mod, "dirstatetuple",
 			   (PyObject *)&dirstateTupleType);
diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -1930,8 +1930,7 @@  bail:
 void revlog_module_init(PyObject *mod)
 {
 	indexType.tp_new = PyType_GenericNew;
-	if (PyType_Ready(&indexType) < 0 ||
-	    PyType_Ready(&dirstateTupleType) < 0)
+	if (PyType_Ready(&indexType) < 0)
 		return;
 	Py_INCREF(&indexType);
 	PyModule_AddObject(mod, "index", (PyObject *)&indexType);