mercurial/parsers.c
changeset 25584 72b2711f12ea
parent 25583 ce64c9ab19f2
child 25810 82d6a35cf432
--- a/mercurial/parsers.c	Mon Jun 15 22:37:33 2015 -0700
+++ b/mercurial/parsers.c	Mon Jun 15 22:41:30 2015 -0700
@@ -185,6 +185,16 @@
 	return _PyDict_NewPresized(((1 + expected_size) / 2) * 3);
 }
 
+static PyObject *dict_new_presized(PyObject *self, PyObject *args)
+{
+	Py_ssize_t expected_size;
+
+	if (!PyArg_ParseTuple(args, "n:make_presized_dict", &expected_size))
+		return NULL;
+
+	return _dict_new_presized(expected_size);
+}
+
 static PyObject *make_file_foldmap(PyObject *self, PyObject *args)
 {
 	PyObject *dmap, *spec_obj, *normcase_fallback;
@@ -2524,6 +2534,8 @@
 	{"parse_index2", parse_index2, METH_VARARGS, "parse a revlog index\n"},
 	{"asciilower", asciilower, METH_VARARGS, "lowercase an ASCII string\n"},
 	{"asciiupper", asciiupper, METH_VARARGS, "uppercase an ASCII string\n"},
+	{"dict_new_presized", dict_new_presized, METH_VARARGS,
+	 "construct a dict with an expected size\n"},
 	{"make_file_foldmap", make_file_foldmap, METH_VARARGS,
 	 "make file foldmap\n"},
 	{"encodedir", encodedir, METH_VARARGS, "encodedir a path\n"},