[PATCH 1 of 7] util.h: Utility macros for handling different Python APIs

Matt Mackall mpm at selenic.com
Thu Jun 10 12:19:37 CDT 2010


On Thu, 2010-06-10 at 10:39 -0300, Renato Cunha wrote:
> # HG changeset patch
> # User Renato Cunha <renatoc at gmail.com>
> # Date 1276177147 10800
> # Node ID 8530f003b636e75a64eb8b4c7bb283697f829791
> # Parent  800a49bb0e54e19f577e3e1cecbc9d6b3bb470c9
> util.h: Utility macros for handling different Python APIs.
> 
> The macros are defined according to their meaning in Python 3. So a call to
> PyString_AsString is now substituted to a call to PYBYTES_AS_STRING, for
> example.
> 
> The macros were only defined for types/functions actually used by hg. This file
> structure is very simple, yet, but, hopefully, the calls in the C modules won't
> need more changes. Except for API changes, perhaps.
> 
> diff --git a/mercurial/util.h b/mercurial/util.h
> new file mode 100644
> --- /dev/null
> +++ b/mercurial/util.h
> @@ -0,0 +1,48 @@
> +/*
> + util.h - utility functions for interfacing with the various python APIs.
> +
> + Copyright 2010 Renato Cunha
> +
> + This software may be used and distributed according to the terms of
> + the GNU General Public License, incorporated herein by reference.
> +*/
> +
> +#ifndef _HG_UTIL_H_
> +#define _HG_UTIL_H_
> +
> +/*
> + Functions affected:
> +
> +   - PyBytes_AsString vs. PyString_AsString
> +   - PyBytes_Size vs. PyString_size
> +   - PyBytes_FromStringAndSize vs. PyString_FromStringAndSize
> +   - PyBytes_AS_STRING vs. PyString_AS_STRING
> +   - PyBytes_GET_SIZE vs. PyString_GET_SIZE
> +   - PyBytes_FromString vs. PyString_FromString
> +*/

This comment is both redundant and incomplete (misses PYINT_FROMLONG).

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list