[issue8020] Crash in Py_ADDRESS_IN_RANGE macro

Tim Peters report at bugs.python.org
Thu Feb 25 23:59:27 CET 2010


Tim Peters <tim.peters at gmail.com> added the comment:

Right, I already agreed it would be fine to fix this if it's cheap ;-)

I didn't give any real thought to the macro solution, but that's fine by me too.  It would be best to embed the assignment in a _natural_ place, though; like, say:

#define Py_ADDRESS_IN_RANGE(P, POOL)			\
	((POOL)->arenaindex < maxarenas &&		\
	 (uptr)(P) - (x = arenas[(POOL)->arenaindex].address) < (uptr)ARENA_SIZE && \
	 x != 0)

where some better name than `x` is picked, and the trick is clearly documented at x's declaration point.  Nothing wrong with expediency here!  This is time-critical code and has always been skating on the edge.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8020>
_______________________________________


More information about the Python-bugs-list mailing list