This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author larry
Recipients Yury.Selivanov, brett.cannon, georg.brandl, jkloth, larry, pitrou, serhiy.storchaka, taleinat, vajrasky, zach.ware
Date 2014-01-22.21:05:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1390424715.11.0.790443777608.issue20341@psf.upfronthosting.co.za>
In-reply-to
Content
> int(or_none=True) ?

Yes, that is a different name that seems to mean much the same thing.


> Hmm, do we have a getargs.h ?

No.  Would it help if I attached the output of "ls Include"
to this issue?


> > > - boolean fields can be "char" instead of "int" (and moved at the
> > >   end to pack the structure more efficiently)
> > 
> > Is Python really compiled with packed structures?
> 
> You don't understand me. If you write:
>   struct X { int A; char B; char C; }
> the structure will be packed *by definition* (IIRC).

I understand you fine.  That's not guaranteed by the C standard,
and I've used compilers that didn't pack structures by default.
More to the point, unaligned accesses on Intel are more expensive
than aligned accesses, and on other architectures I've written
C code using packed structures with unaligned accesses that
produced a bus error.

http://en.wikipedia.org/wiki/Data_structure_alignment#Data_structure_padding

And finally: I removed "error"--you were right, it was unnecessary
for the nullable ints.  So now it's just

  { int error; <whatever> i; }

Changing error to an char and moving it to the end would
save exactly zero bytes, because the compiler *will* align
stack variables to 4 byte boundaries.  I can give you a sample
C program if you want proof.


> > > - PyLong_AsSsize_t can't fail?
> > Not on an object returned by PyNumber_Index().
> And what if the long is too long to fit in a Py_ssize_t?

Ah.  I thought PyNumber_Index guaranteed it would fit, but
I was mistaken.  Code is fixed.


New patch posted.  I believe this fixes all the bugs cited so far.


Also, I don't know what the right thing to do about itertools.repeat
is.  The current signature is a bug, it should not behave differently
between repeat(o, -1) and repeat(o, times=-1).  If we go by the
documentation, repeat(o, None) and repeat(o, times=None) are what we
want.  But I bet code out there relies on repeat(o, times=-1), so we
may be stuck supporting that.  You should consider my signature for
itertools.repeat in these "draft" patches as a proof of concept, not
as code that should be checked in.

The issue is being discussed on #19145.
History
Date User Action Args
2014-01-22 21:05:15larrysetrecipients: + larry, brett.cannon, georg.brandl, pitrou, taleinat, jkloth, Yury.Selivanov, zach.ware, serhiy.storchaka, vajrasky
2014-01-22 21:05:15larrysetmessageid: <1390424715.11.0.790443777608.issue20341@psf.upfronthosting.co.za>
2014-01-22 21:05:15larrylinkissue20341 messages
2014-01-22 21:05:13larrycreate