Hi,
A report was submitted to the Debian BTS
describing a serious bug in pypgsql that can
lead to incorrect numerical results in financial
applications and the like.
The basic problem is that pypgsql uses strtod()
for parsing floats, which interprets strings
according to the current locale. As a result, if you
parse a decimal value (e.g., "1.5") in a locale that
uses a comma as a decimal separator (such as
de_DE), you get an incorrect value (in this case,
1).
Martin Pitt has patched this problem (and I have
also applied this patch to the debian packages).
I have included the patch as an attachment to
this bug.
The patch is simple; replace strtod() with
PyOS_ascii_strtod(). Since PyOS_ascii_strtod()
is only available in python 2.4 and newer, the
patch also includes an implementation of this
function for use with earlier python versions.
For more information on this report, please see
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=311328 .
Ben.
Patch to fix bug
Logged In: YES
user_id=163326
Applied in CVS.