[I hope this belongs on python-dev, since it's about the design of something. But if not, let me know and I'll post to c.l.py.]
I'm willing to file a bug report and patch on this, but I'd like to know if it's by design or not. In datetimemodule.c, the function wrap_strftime() insists that the length of a format string be <= 127 chars, by forcing the length into a char. This seems like a bug to me. wrap_strftime() calls time's strftime(), which doesn't have this limitation because it uses size_t. >>> import datetime >>> datetime.datetime.now().strftime('x'*128) Traceback (most recent call last): File "<stdin>", line 1, in ? MemoryError >>> import datetime >>> datetime.datetime.now().strftime('x'*256) in wrap_strftime totalnew=1 Traceback (most recent call last): File "<stdin>", line 1, in <module> SystemError: Objects/stringobject.c:4077: bad argument to internal function >>> import time >>> time.strftime('x'*128) 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' But before I write this up, I'd like to know if anyone knows if this is by design or not. This is reproducible on Windows 2.4.3, and Linux 2.3.3 and 2.5c1. Thanks. Eric. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com