Message223073
> (there's no room for an extra 10 bits in the
> carefully arranged 8-byte internal representation)
According to a comment on top of Include/datetime.h, the internal representation of datetime is 10, not 8 bytes.
/* Fields are packed into successive bytes, each viewed as unsigned and
* big-endian, unless otherwise noted:
*
* byte offset
* 0 year 2 bytes, 1-9999
* 2 month 1 byte, 1-12
* 3 day 1 byte, 1-31
* 4 hour 1 byte, 0-23
* 5 minute 1 byte, 0-59
* 6 second 1 byte, 0-59
* 7 usecond 3 bytes, 0-999999
* 10
*/
(if you don't trust the comments check the definitions a few lines below)
#define _PyDateTime_DATETIME_DATASIZE 10
AFAIK, Python objects are allocated with at least 32-bit alignment, so we have at least 2 unused bytes at the end of each datetime object.
Furthermore, out of 24 bits allocated for microseconds, only 20 are used, so nanoseconds can be accommodated by adding a single byte to DATETIME_DATASIZE. |
|
Date |
User |
Action |
Args |
2014-07-15 01:37:38 | belopolsky | set | recipients:
+ belopolsky, lemburg, tim.peters, pitrou, vstinner, Arfrever, r.david.murray, andrewclegg, Ramchandra Apte, goshawk, Niklas.Claesson |
2014-07-15 01:37:38 | belopolsky | set | messageid: <1405388258.52.0.113863626436.issue15443@psf.upfronthosting.co.za> |
2014-07-15 01:37:38 | belopolsky | link | issue15443 messages |
2014-07-15 01:37:37 | belopolsky | create | |
|