mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 17:06:33 +03:00
Add negative infinity support for Python->pg conversion
This commit is contained in:
parent
9e9c221637
commit
9cb72a38da
|
@ -42,8 +42,12 @@ pfloat_getquoted(pfloatObject *self, PyObject *args)
|
|||
double n = PyFloat_AsDouble(self->wrapped);
|
||||
if (isnan(n))
|
||||
rv = Bytes_FromString("'NaN'::float");
|
||||
else if (isinf(n))
|
||||
rv = Bytes_FromString("'Infinity'::float");
|
||||
else if (isinf(n)) {
|
||||
if (n > 0)
|
||||
rv = Bytes_FromString("'Infinity'::float");
|
||||
else
|
||||
rv = Bytes_FromString("'-Infinity'::float");
|
||||
}
|
||||
else {
|
||||
rv = PyObject_Repr(self->wrapped);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user