[Python-checkins] r66661 - python/trunk/Doc/howto/cporting.rst

benjamin.peterson python-checkins at python.org
Sun Sep 28 01:28:44 CEST 2008


Author: benjamin.peterson
Date: Sun Sep 28 01:28:43 2008
New Revision: 66661

Log:
clarify a few things

Modified:
   python/trunk/Doc/howto/cporting.rst

Modified: python/trunk/Doc/howto/cporting.rst
==============================================================================
--- python/trunk/Doc/howto/cporting.rst	(original)
+++ python/trunk/Doc/howto/cporting.rst	Sun Sep 28 01:28:43 2008
@@ -45,7 +45,7 @@
 2.x's :func:`unicode` (``PyUnicode_*``).  The old 8-bit string type has become
 :func:`bytes`.  Python 2.6 and later provide a compatibility header,
 :file:`bytesobject.h`, mapping ``PyBytes`` names to ``PyString`` ones.  For best
-interpolation with 3.0, :ctype:`PyUnicode` should be used for textual data and
+compatibility with 3.0, :ctype:`PyUnicode` should be used for textual data and
 :ctype:`PyBytes` for binary data.  It's also important to remember that
 :ctype:`PyBytes` and :ctype:`PyUnicode` in 3.0 are not interchangeable like
 :ctype:`PyString` and :ctype:`PyString` are in 2.x.  The following example shows
@@ -68,6 +68,7 @@
        return result;
    }
 
+   /* just a forward */
    static char * do_encode(PyObject *);
 
    /* bytes example */
@@ -94,14 +95,12 @@
 In Python 3.0, there is only one integer type.  It is called :func:`int` on the
 Python level, but actually corresponds to 2.x's :func:`long` type.  In the
 C-API, ``PyInt_*`` functions are replaced by their ``PyLong_*`` neighbors.  The
-best course of action here is probably aliasing ``PyInt_*`` functions to
-``PyLong_*`` variants or using the abstract ``PyNumber_*`` APIs. ::
+best course of action here is using the ``PyInt_*`` functions aliased to
+``PyLong_*`` found in :file:`intobject.h`.  The the abstract ``PyNumber_*`` APIs
+can also be used in some cases. ::
 
    #include "Python.h"
-
-   #if PY_MAJOR_VERSION >= 3
-   #define PyInt_FromLong PyLong_FromLong
-   #endif
+   #include "intobject.h"
 
    static PyObject *
    add_ints(PyObject *self, PyObject *args) {


More information about the Python-checkins mailing list