
Author: martin.v.loewis Date: Sun Apr 29 15:46:08 2007 New Revision: 55017 Modified: peps/trunk/pep-3123.txt Log: Add Brett's suggested changes. Modified: peps/trunk/pep-3123.txt ============================================================================== --- peps/trunk/pep-3123.txt (original) +++ peps/trunk/pep-3123.txt Sun Apr 29 15:46:08 2007 @@ -45,8 +45,8 @@ The problem here is that the storage is both accessed as if it where struct PyObject, and as struct FooObject. -Historically, compilers did not cause any problems with this -code. However, modern compiler use that clause as an +Historically, compilers did not have any problems with this +code. However, modern compilers use that clause as an optimization opportunity, finding that f->ob_refcnt and o->ob_refcnt cannot possibly refer to the same memory, and that therefore the function should return 0, without having @@ -110,7 +110,18 @@ #define Py_Type(o) (((PyObject*)o)->ob_type) -is added. +is added. E.g. the code blocks:: + + #define PyList_CheckExact(op) ((op)->ob_type == &PyList_Type) + + return func->ob_type->tp_name; + +needs to be changed to:: + + #define PyList_CheckExact(op) (Py_Type(op) == &PyList_Type) + + return Py_Type(func)->tp_name; + Compatibility with Python 2.6 =============================
participants (1)
-
martin.v.loewis