[egenix-users] DeprecationWarning with Python 2.3c1

Jacob Smullyan smulloni at smullyan.org
Sun Jul 20 16:45:37 CEST 2003


Using mx base 2.1.0b5, the following code produces a DeprecationWarning
in the latest Python (also as far back as 2.3b1, at least):

>>> import mx.DateTime as M
>>> n=M.now()
>>> import time
>>> time.strftime('%Y', n.tuple())
__main__:1: DeprecationWarning: integer argument expected, got float
'2003'

The tuple returned contains a float rather than an int for the "second"
field.  From the 2.3 release notes (from the 2.3a2 C API section):  "The
PyArg_Parse functions now issue a DeprecationWarning if a float    
argument is provided when an integer is specified (this affects the 'b',
'B', 'h', 'H', 'i', and 'l' codes). Future versions of Python will raise
a TypeError."

Whether this is a bug in time.strftime or in mx.DateTime, I leave to
your better judgement.  Also, don't ask why someone is using
time.strftime with mx.DateTime this way, because I have no idea! 
Nonetheless, if the tuple returned from DateTimeType.tuple() isn't
compatible is those used in the time module, there isn't a whole lot of
point to them.

Cheers,

Jacob Smullyan

-- 
Jacob Smullyan <smulloni at smullyan.org>
gpg --keyserver pgp.mit.edu --recv-keys 21575CB2
Fingerprint 1894 D37C FA6B 1CC7 F0B4  0A89 BAA6 A617 2157 5CB2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : /mailman-archives/egenix-users/attachments/20030720/6481cf52/attachment-0139.bin


More information about the egenix-users mailing list