Fixed problem with year > 9999.

This commit is contained in:
Federico Di Gregorio 2007-01-16 07:57:22 +00:00
parent 401af084ab
commit d061b384d9
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2007-01-16 Federico Di Gregorio <fog@initd.org>
* psycopg/typecast_datetime.c: fixed problem with year > 9999.
2006-10-29 Federico Di Gregorio <fog@initd.org>
* Applied patch from Jason Erickson to make psycopg build

View File

@ -59,6 +59,7 @@ typecast_PYDATE_cast(char *str, int len, PyObject *curs)
PyErr_SetString(DataError, "unable to parse date");
}
else {
if (y > 9999) y = 9999;
obj = PyObject_CallFunction(pyDateTypeP, "iii", y, m, d);
}
}
@ -111,6 +112,8 @@ typecast_PYDATETIME_cast(char *str, int len, PyObject *curs)
mm += 1;
ss -= 60;
}
if (y > 9999)
y = 9999;
if (n == 5 && ((cursorObject*)curs)->tzinfo_factory != Py_None) {
/* we have a time zone, calculate minutes and create