Author hfuru
Recipients hfuru
Date 2010-11-04.11:51:17
SpamBayes Score 1.92922e-08
Marked as misclassified No
Message-id <1288871480.25.0.737532033065.issue10310@psf.upfronthosting.co.za>
In-reply-to
Content
In Python 2.7 and 3.2a3, Modules/_io/textio.c uses signed:1 bitfields.

They have value -1 or 0 in two's complement, but are not used thus here:
gcc complains of <bitfield> = 1 overflow.  If the point was that they
are assigned signed values, well, unsigned:1 is promoted to signed int.

I also fix a strange (int) cast doing (truncate flag to int) & 1.
My guess is someone shut up a compiler warning about the above,
by cleaning up in the wrong place.  I kept a cast in case that's
not it, and some compiler would get noisy anyway.

There are possibly-signed 1-bit fields Modules/_ctypes/_ctypes_test.c:
struct BITS too, but I don't know what that code is for.  It does not
specify signedness of the bitfields, which (as with char) makes it the
compiler's choice.  That's usually a bad idea, but maybe that code is
for exploring the compiler?
History
Date User Action Args
2010-11-04 11:51:20hfurusetrecipients: + hfuru
2010-11-04 11:51:20hfurusetmessageid: <1288871480.25.0.737532033065.issue10310@psf.upfronthosting.co.za>
2010-11-04 11:51:18hfurulinkissue10310 messages
2010-11-04 11:51:17hfurucreate