Mercurial > hg
comparison mercurial/pathencode.c @ 30163:f5607b6253da
pathencode: use assert() for PyBytes_Check()
This should have been added in a8c948ee3668. I sent the patch to the
list prematurely.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 13 Oct 2016 21:42:11 +0200 |
parents | a8c948ee3668 |
children |
comparison
equal
deleted
inserted
replaced
30162:5cb830801855 | 30163:f5607b6253da |
---|---|
637 | 637 |
638 if (lastdot >= 0) | 638 if (lastdot >= 0) |
639 memcopy(dest, &destlen, destsize, &src[lastdot], | 639 memcopy(dest, &destlen, destsize, &src[lastdot], |
640 len - lastdot - 1); | 640 len - lastdot - 1); |
641 | 641 |
642 PyBytes_Check(ret); | 642 assert(PyBytes_Check(ret)); |
643 Py_SIZE(ret) = destlen; | 643 Py_SIZE(ret) = destlen; |
644 | 644 |
645 return ret; | 645 return ret; |
646 } | 646 } |
647 | 647 |
750 } | 750 } |
751 | 751 |
752 newobj = PyBytes_FromStringAndSize(NULL, newlen); | 752 newobj = PyBytes_FromStringAndSize(NULL, newlen); |
753 | 753 |
754 if (newobj) { | 754 if (newobj) { |
755 PyBytes_Check(newobj); | 755 assert(PyBytes_Check(newobj)); |
756 Py_SIZE(newobj)--; | 756 Py_SIZE(newobj)--; |
757 basicencode(PyBytes_AS_STRING(newobj), newlen, path, | 757 basicencode(PyBytes_AS_STRING(newobj), newlen, path, |
758 len + 1); | 758 len + 1); |
759 } | 759 } |
760 } | 760 } |