Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment:

I don't like this modification of a PyString object:

+       n = PyString_GET_SIZE(conv);
+       conv_str = PyString_AS_STRING(conv);
+       /* Remove the trailing 'L' if present */
+       if (n && conv_str[n-1] == 'L')
+               conv_str[n-1] = '\0';
+       result = PyString_FromFormat("%s * 2.0 ** %d", conv_str, exp);

The string may have other references (ex: all single-char strings are
shared) and it seems unwise to directly modify the memory.

Also, tests should check if negative numbers have the same
representation as their absolute value (with the sign). It is not
obvious from the implementation, which uses floor().

----------
nosy: +amaury.forgeotdarc

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3008>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to