Larry Hastings added the comment:

For the record: I care.  Generally speaking CPython is a lovingly
crafted source tree, and the choices its architects made are nearly
always sensible and well-reasoned.  When I see things like this, things
that seem kind of dumb on first glance, I worry that we're missing
something.

It could be that it did have a sensible reason fifteen years ago, like
some bone-headed compiler generated awful code--and the macros *are*
used everywhere, so maybe performance genuinely suffered.  Or maybe
the macros were originally intended to be usable as rvalues; it looks
like Py_INCREF still permits that, and changing it to be a statement
could be considered a breaking API change.

But we can't let ourselves become hidebound and superstitious.  I see
no reason why a local temporary variable shouldn't be fine here, and
perhaps in all the macros Mark cites.  So don't get me wrong, I'm +1.

(The documentation on Py_INCREF makes no mention of whether it's legal
as an rvalue, and all the examples use it as a statement.  Perhaps we
should document it explicitly so for 3.4.)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17206>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to