dirs: document Py_SIZE weirdness
authorGregory Szorc <gregory.szorc@gmail.com>
Sat, 08 Oct 2016 17:07:43 +0200
changeset 30159 fb5504d7b2c9
parent 30158 1baa0e2cfc37
child 30160 008c4ce64e3f
dirs: document Py_SIZE weirdness Assigning to what looks like a function is clown shoes. Document that it is a macro referring to a struct member.
mercurial/dirs.c
--- a/mercurial/dirs.c	Wed Oct 12 12:22:54 2016 +0200
+++ b/mercurial/dirs.c	Sat Oct 08 17:07:43 2016 +0200
@@ -76,6 +76,8 @@
 			if (key == NULL)
 				goto bail;
 		}
+		/* Py_SIZE(o) refers to the ob_size member of the struct. Yes,
+		* assigning to what looks like a function seems wrong. */
 		Py_SIZE(key) = pos;
 		((PyBytesObject *)key)->ob_sval[pos] = '\0';