# HG changeset patch # User Gregory Szorc # Date 2016-10-08 14:02:51 # Node ID 63e1dca2d6a46e94b30855b4e34d9ad79f12d3d8 # Parent 74cd33c9be76c11ba42ba5f2448dcf90419866ba dirs: inline string macros The old code happened to work because of how the macro was defined. This no longer works in Python 3. Furthermore, assigning to a macro just feels weird. So just inline the macro. diff --git a/mercurial/dirs.c b/mercurial/dirs.c --- a/mercurial/dirs.c +++ b/mercurial/dirs.c @@ -61,8 +61,8 @@ static int _addpath(PyObject *dirs, PyOb if (key == NULL) goto bail; } - PyString_GET_SIZE(key) = pos; - PyString_AS_STRING(key)[pos] = '\0'; + Py_SIZE(key) = pos; + ((PyStringObject *)key)->ob_sval[pos] = '\0'; val = PyDict_GetItem(dirs, key); if (val != NULL) {