mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-17 01:20:32 +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);
|
double n = PyFloat_AsDouble(self->wrapped);
|
||||||
if (isnan(n))
|
if (isnan(n))
|
||||||
rv = Bytes_FromString("'NaN'::float");
|
rv = Bytes_FromString("'NaN'::float");
|
||||||
else if (isinf(n))
|
else if (isinf(n)) {
|
||||||
rv = Bytes_FromString("'Infinity'::float");
|
if (n > 0)
|
||||||
|
rv = Bytes_FromString("'Infinity'::float");
|
||||||
|
else
|
||||||
|
rv = Bytes_FromString("'-Infinity'::float");
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
rv = PyObject_Repr(self->wrapped);
|
rv = PyObject_Repr(self->wrapped);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user