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 belopolsky
Recipients belopolsky, mark.dickinson
Date 2010-06-20.01:44:13
SpamBayes Score 1.8536187e-07
Marked as misclassified No
Message-id <1276998258.21.0.743259532258.issue9034@psf.upfronthosting.co.za>
In-reply-to
Content
"""
As an aside, I dislike the fact that the datetime module uses a C 'int' for date ordinals, and clearly assumes that it'll be at least 32 bits.  int could be as small as 16 bits on some systems (small embedded systems?).  But that's another issue.
""" -- Mark Dickinson 

A comment and an assertion at the top of the module suggest that this was deliberate.

/* We require that C int be at least 32 bits, and use int virtually                                                                                  
 * everywhere.  In just a few cases we use a temp long, where a Python                                                                               
 * API returns a C long.  In such cases, we have to ensure that the                                                                                  
 * final result fits in a C int (this can be an issue on 64-bit boxes).                                                                              
 */
#if SIZEOF_INT < 4
#       error "datetime.c requires that C int have at least 32 bits"
#endif

However, since ranges of all integers are well defined in this module, there is little to be gained from the uncertainty about sizes of int and long. (For example, the allowed range of dates will not magically increase on a platform with 64 bit ints.)

I propose using explicitly sized C99 types int32_t and int64_t or rather their blessed for use in python equivalents PY_INTXX_T) throughout the module.
History
Date User Action Args
2010-06-20 01:44:18belopolskysetrecipients: + belopolsky, mark.dickinson
2010-06-20 01:44:18belopolskysetmessageid: <1276998258.21.0.743259532258.issue9034@psf.upfronthosting.co.za>
2010-06-20 01:44:15belopolskylinkissue9034 messages
2010-06-20 01:44:13belopolskycreate