Message185646
CPython API "functions" implemented as macros can expand into either
rvalues or statements. Most expand into statements (often using the
do {} while (0) syntactic sugar trick), but occasionally they're legal
as rvalues.
As of this writing Py_INCREF works as an rvalue. But discussion on
another tracker issue (#17206) proposes changing the implementation
in such a way that it will only be usable as a statement. Although
it's mildly unlikely, it's certainly possible that this will break
somebody's code.
I propose that the documentation make an explicit ruling on whether
macros are usable as rvalues or as statements. Perhaps a blanket
statement would suffice, "all macros are only supported for use as
statements except where explicitly noted", then annotate specific
macros that are supported for use as rvalues. Though that raises the
question of acknowledging in the documentation that some things are
macros--I think the documentation glosses over that fact right now.
Note: I added you three (Georg, Mark, Martin) as I thought you might
have an opinion on this one way or the other. If you're not interested,
my apologies. |
|
Date |
User |
Action |
Args |
2013-03-31 19:39:15 | larry | set | recipients:
+ larry, loewis, georg.brandl, docs@python, Mark.Shannon |
2013-03-31 19:39:15 | larry | set | messageid: <1364758755.79.0.998719447408.issue17589@psf.upfronthosting.co.za> |
2013-03-31 19:39:15 | larry | link | issue17589 messages |
2013-03-31 19:39:15 | larry | create | |
|