changeset 30159:fb5504d7b2c9

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.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 08 Oct 2016 17:07:43 +0200
parents 1baa0e2cfc37
children 008c4ce64e3f
files mercurial/dirs.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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';