summaryrefslogtreecommitdiff
path: root/psycopg
diff options
context:
space:
mode:
authorFederico Di Gregorio <fog@initd.org>2007-01-16 07:57:22 +0000
committerFederico Di Gregorio <fog@initd.org>2007-01-16 07:57:22 +0000
commitd061b384d941d544de4d989c0496e7415e4d4201 (patch)
treeea141d439567bd50eff81ba567de24f793bf6195 /psycopg
parent401af084ab497bd0be38b9e5994caac1eff6db11 (diff)
downloadpsycopg2-d061b384d941d544de4d989c0496e7415e4d4201.tar.gz
Fixed problem with year > 9999.
Diffstat (limited to 'psycopg')
-rw-r--r--psycopg/typecast_datetime.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/psycopg/typecast_datetime.c b/psycopg/typecast_datetime.c
index 3a09f07..a3919b3 100644
--- a/psycopg/typecast_datetime.c
+++ b/psycopg/typecast_datetime.c
@@ -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,7 +112,9 @@ 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
appropriate tzinfo object calling the factory */