Add Brett's suggested changes.

This commit is contained in:
Martin v. Löwis 2007-04-29 13:46:08 +00:00
parent a20cd09644
commit d4d0b01433
1 changed files with 14 additions and 3 deletions

View File

@ -45,8 +45,8 @@ code has undefined behavior::
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 @@ ob_type, a macro::
#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
=============================