Re: [PATCH] pathencode: use assert() for PyBytes_Check()

2016-10-14 Thread Yuya Nishihara
On Thu, 13 Oct 2016 21:42:42 +0200, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc 
> # Date 1476387731 -7200
> #  Thu Oct 13 21:42:11 2016 +0200
> # Node ID 4bbdf012fafbdffd4d4402a712fdc01d3252d00c
> # Parent  c0410814002f467c24ef07ce73850ba15b306f8e
> pathencode: use assert() for PyBytes_Check()

Queued, thanks!
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] pathencode: use assert() for PyBytes_Check()

2016-10-13 Thread Gregory Szorc
# HG changeset patch
# User Gregory Szorc 
# Date 1476387731 -7200
#  Thu Oct 13 21:42:11 2016 +0200
# Node ID 4bbdf012fafbdffd4d4402a712fdc01d3252d00c
# Parent  c0410814002f467c24ef07ce73850ba15b306f8e
pathencode: use assert() for PyBytes_Check()

This should have been added in a8c948ee3668. I sent the patch to the
list prematurely.

diff --git a/mercurial/pathencode.c b/mercurial/pathencode.c
--- a/mercurial/pathencode.c
+++ b/mercurial/pathencode.c
@@ -638,9 +638,9 @@ static PyObject *hashmangle(const char *
if (lastdot >= 0)
memcopy(dest, &destlen, destsize, &src[lastdot],
len - lastdot - 1);
 
-   PyBytes_Check(ret);
+   assert(PyBytes_Check(ret));
Py_SIZE(ret) = destlen;
 
return ret;
 }
@@ -751,9 +751,9 @@ PyObject *pathencode(PyObject *self, PyO
 
newobj = PyBytes_FromStringAndSize(NULL, newlen);
 
if (newobj) {
-   PyBytes_Check(newobj);
+   assert(PyBytes_Check(newobj));
Py_SIZE(newobj)--;
basicencode(PyBytes_AS_STRING(newobj), newlen, path,
len + 1);
}
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel