summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2011-04-11 11:44:20 +0200
committerJulian Andres Klode <jak@debian.org>2011-04-11 11:44:20 +0200
commit2a0f97e8ad0ed8ac7456b8dc785071bf1c3a1847 (patch)
treeb3f79e26025f4add4b9fa2aa163db9931f7de62b
parentd5e763e1920eadf0bc0d460abbf686c65db2a3b4 (diff)
downloadpython-apt-2a0f97e8ad0ed8ac7456b8dc785071bf1c3a1847.tar.gz
apt_pkg: Fix time_to_str, time_rfc1123 to accept more correct values
(time_to_str accepts unsigned long, time_rfc1123 long long, y2k31-correct).
-rw-r--r--debian/changelog2
-rw-r--r--python/string.cc10
2 files changed, 7 insertions, 5 deletions
diff --git a/debian/changelog b/debian/changelog
index e71cd63a..2272462a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ python-apt (0.8.0~exp2) UNRELEASED; urgency=low
* all: Fix all instances of ResourceWarning about unclosed files
* tests/test_apt_cache.py: Use assertTrue() instead of assert_()
* apt_pkg: Raise error when parse_commandline gets empty argv (LP: #707416)
+ * apt_pkg: Fix time_to_str, time_rfc1123 to accept more correct values
+ (time_to_str accepts unsigned long, time_rfc1123 long long, y2k31-correct).
-- Julian Andres Klode <jak@debian.org> Wed, 06 Apr 2011 09:46:52 +0200
diff --git a/python/string.cc b/python/string.cc
index 6a1ce4e2..a5016103 100644
--- a/python/string.cc
+++ b/python/string.cc
@@ -28,11 +28,11 @@ PyObject *Python(PyObject *Self,PyObject *Args) \
return CppPyString(CFunc(Str)); \
}
-#define MkInt(Python,CFunc) \
+#define MkInt(Python,CFunc, ctype, pytype) \
PyObject *Python(PyObject *Self,PyObject *Args) \
{ \
- int Val = 0; \
- if (PyArg_ParseTuple(Args,"i",&Val) == 0) \
+ ctype Val = 0; \
+ if (PyArg_ParseTuple(Args,pytype,&Val) == 0) \
return 0; \
return CppPyString(CFunc(Val)); \
}
@@ -56,8 +56,8 @@ PyObject *StrBase64Encode(PyObject *Self,PyObject *Args) {
MkStr(StrURItoFileName,URItoFileName);
//MkFloat(StrSizeToStr,SizeToStr);
-MkInt(StrTimeToStr,TimeToStr);
-MkInt(StrTimeRFC1123,TimeRFC1123);
+MkInt(StrTimeToStr,TimeToStr, unsigned long, "k");
+MkInt(StrTimeRFC1123,TimeRFC1123, long long, "L");
/*}}}*/
// Other String functions /*{{{*/