[PATCH] dirs: add comment about _PyBytes_Resize

Gregory Szorc gregory.szorc at gmail.com
Thu Oct 13 08:59:32 UTC 2016


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1476349169 -7200
#      Thu Oct 13 10:59:29 2016 +0200
# Node ID 27e00e6352ceadb48c11c6f5902093a26d58f569
# Parent  733fb9f7bc92c694ba6bededaeb93206528c0bcd
dirs: add comment about _PyBytes_Resize

So readers have a canonical function to compare this code to.

diff --git a/mercurial/dirs.c b/mercurial/dirs.c
--- a/mercurial/dirs.c
+++ b/mercurial/dirs.c
@@ -58,9 +58,10 @@ static int _addpath(PyObject *dirs, PyOb
 	* implementation details. We also commit violations of the Python
 	* "protocol" such as mutating immutable objects. But since we only
 	* mutate objects created in this function or in other well-defined
 	* locations, the references are known so these violations should go
-	* unnoticed. */
+	* unnoticed. The code for adjusting the length of a PyBytesObject is
+	* essentially a minimal version of _PyBytes_Resize. */
 	while ((pos = _finddir(cpath, pos - 1)) != -1) {
 		PyObject *val;
 
 		/* It's likely that every prefix already has an entry


More information about the Mercurial-devel mailing list