Bug in Python/C API?

David Bolen db3l at fitlinxx.com
Mon Sep 11 17:30:04 EDT 2000


"Rainer Deyke" <root at rainerdeyke.com> writes:

> This sort of problem could be prevented if Py_XDECREF was defined like this:
> 
> #define Py_XDECREF(A) if (tmp = (A)) Py_DECREF(A)
> 
> where tmp is a global PyObject *.

Except that among other arguments, doing that wouldn't be thread-safe.

It's just better to always assume that you shouldn't use side-effect
expressions in macros unless you're very confident as to how that
macro is defined (and probably not even then :-)).

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list