Mercurial > hg
comparison mercurial/cext/pathencode.c @ 48330:e35807332598 stable
cext: fix Python 3.11 compatibility - Py_SIZE is not an lvalue (issue6610)
Py_SIZE was made a static inline function during Python 3.10 development, as
described on https://vstinner.github.io/c-api-opaque-structures.html .
e92ca942ddca updated the Mercurial code base accordingly, but somehow missed a
couple of cases introduced long time ago in a8c948ee3668.
The Python change was dropped for 3.10, but is coming back again in 3.11 .
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Thu, 18 Nov 2021 12:31:37 +0100 |
parents | e92ca942ddca |
children | b0dd39b91e7a |
comparison
equal
deleted
inserted
replaced
48328:e74c15bd58ee | 48330:e35807332598 |
---|---|
174 | 174 |
175 newobj = PyBytes_FromStringAndSize(NULL, newlen); | 175 newobj = PyBytes_FromStringAndSize(NULL, newlen); |
176 | 176 |
177 if (newobj) { | 177 if (newobj) { |
178 assert(PyBytes_Check(newobj)); | 178 assert(PyBytes_Check(newobj)); |
179 Py_SIZE(newobj)--; | 179 Py_SET_SIZE(newobj, Py_SIZE(newobj) - 1); |
180 _encodedir(PyBytes_AS_STRING(newobj), newlen, path, len + 1); | 180 _encodedir(PyBytes_AS_STRING(newobj), newlen, path, len + 1); |
181 } | 181 } |
182 | 182 |
183 return newobj; | 183 return newobj; |
184 } | 184 } |
789 | 789 |
790 newobj = PyBytes_FromStringAndSize(NULL, newlen); | 790 newobj = PyBytes_FromStringAndSize(NULL, newlen); |
791 | 791 |
792 if (newobj) { | 792 if (newobj) { |
793 assert(PyBytes_Check(newobj)); | 793 assert(PyBytes_Check(newobj)); |
794 Py_SIZE(newobj)--; | 794 Py_SET_SIZE(newobj, Py_SIZE(newobj) - 1); |
795 basicencode(PyBytes_AS_STRING(newobj), newlen, path, | 795 basicencode(PyBytes_AS_STRING(newobj), newlen, path, |
796 len + 1); | 796 len + 1); |
797 } | 797 } |
798 } else { | 798 } else { |
799 newobj = hashencode(path, len + 1); | 799 newobj = hashencode(path, len + 1); |