[PATCH 3 of 3] inotify extension: Port of the C module to py3k

Antoine Pitrou solipsis at pitrou.net
Thu Jun 17 06:37:39 CDT 2010


About this change and the following:

> @@ -338,7 +338,7 @@
>  	PyObject *join = NULL;
>  	char *maskstr;
> 
> -	join = PyString_FromString("|");
> +	join = PyBytes_FromString("|");

repr() should really return a str object under 3.x, not a bytes one. So you have
to use PyString_FromString for 2.x, and PyUnicode_FromString for 3.x.
(perhaps you want another set of #define's)

> @@ -525,7 +524,7 @@
>  			evt->cookie = Py_None;
>  		}
>  		if (in->len)
> -			evt->name = PyString_FromString(in->name);
> +			evt->name = PyBytes_FromString(in->name);

If this is meant to be human-readable text, it should probably be a str object
under 3.x (same as above for repr()).

Regards

Antoine.




More information about the Mercurial-devel mailing list