Re: [PATCH] dirs: add comment about _PyBytes_Resize

2016-10-13 Thread Pierre-Yves David



On 10/13/2016 10:59 AM, Gregory Szorc wrote:

# HG changeset patch
# User Gregory Szorc 
# 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.


Sure, pushed, thanks.

Cheers,

--
Pierre-Yves David
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] dirs: add comment about _PyBytes_Resize

2016-10-13 Thread Gregory Szorc
# HG changeset patch
# User Gregory Szorc 
# 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
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel