From 4c11a926255ba5c798b52ce9529a37b9bae99132 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= <martin@v.loewis.de>
Date: Thu, 8 Feb 2007 09:13:36 +0000
Subject: Bug #1653736: Complain about keyword arguments to time.isoformat.
 Will backport to 2.5.

---
 Lib/test/test_datetime.py | 5 +++++
 Misc/NEWS                 | 2 ++
 Modules/datetimemodule.c  | 4 ++--
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py
index 436cfca..3aa0468 100644
--- a/Lib/test/test_datetime.py
+++ b/Lib/test/test_datetime.py
@@ -1740,6 +1740,11 @@ class TestTime(HarmlessMixedComparison):
         self.assertEqual(t.isoformat(), "00:00:00.100000")
         self.assertEqual(t.isoformat(), str(t))
 
+    def test_1653736(self):
+        # verify it doesn't accept extra keyword arguments
+        t = self.theclass(second=1)
+        self.assertRaises(TypeError, t.isoformat, foo=3)
+
     def test_strftime(self):
         t = self.theclass(1, 2, 3, 4)
         self.assertEqual(t.strftime('%H %M %S'), "01 02 03")
diff --git a/Misc/NEWS b/Misc/NEWS
index 0447d4b..25b72c2 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -347,6 +347,8 @@ Library
 Extension Modules
 -----------------
 
+- Bug #1653736: Complain about keyword arguments to time.isoformat.
+
 - Bug #1486663: don't reject keyword arguments for subclasses of builtin
   types.
 
diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c
index 39a859f..cf8a68b 100644
--- a/Modules/datetimemodule.c
+++ b/Modules/datetimemodule.c
@@ -3167,7 +3167,7 @@ time_str(PyDateTime_Time *self)
 }
 
 static PyObject *
-time_isoformat(PyDateTime_Time *self)
+time_isoformat(PyDateTime_Time *self, PyObject *unused)
 {
 	char buf[100];
 	PyObject *result;
@@ -3411,7 +3411,7 @@ time_reduce(PyDateTime_Time *self, PyObject *arg)
 
 static PyMethodDef time_methods[] = {
 
-	{"isoformat",   (PyCFunction)time_isoformat,	METH_KEYWORDS,
+	{"isoformat",   (PyCFunction)time_isoformat,	METH_NOARGS,
 	 PyDoc_STR("Return string in ISO 8601 format, HH:MM:SS[.mmmmmm]"
 	 	   "[+HH:MM].")},
 
-- 
cgit v0.12

