mirror of
https://github.com/python/cpython.git
synced 2025-08-21 17:25:34 +00:00
Bug #1653736: Complain about keyword arguments to time.isoformat.
This commit is contained in:
parent
0bafda4546
commit
2e8b602ac1
3 changed files with 9 additions and 2 deletions
|
@ -1740,6 +1740,11 @@ class TestTime(HarmlessMixedComparison):
|
||||||
self.assertEqual(t.isoformat(), "00:00:00.100000")
|
self.assertEqual(t.isoformat(), "00:00:00.100000")
|
||||||
self.assertEqual(t.isoformat(), str(t))
|
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):
|
def test_strftime(self):
|
||||||
t = self.theclass(1, 2, 3, 4)
|
t = self.theclass(1, 2, 3, 4)
|
||||||
self.assertEqual(t.strftime('%H %M %S'), "01 02 03")
|
self.assertEqual(t.strftime('%H %M %S'), "01 02 03")
|
||||||
|
|
|
@ -105,6 +105,8 @@ Core and builtins
|
||||||
Extension Modules
|
Extension Modules
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Bug #1653736: Complain about keyword arguments to time.isoformat.
|
||||||
|
|
||||||
- operator.count() now raises an OverflowError when the count reaches sys.maxint.
|
- operator.count() now raises an OverflowError when the count reaches sys.maxint.
|
||||||
|
|
||||||
- Bug #1575169: operator.isSequenceType() now returns False for subclasses of dict.
|
- Bug #1575169: operator.isSequenceType() now returns False for subclasses of dict.
|
||||||
|
|
|
@ -3167,7 +3167,7 @@ time_str(PyDateTime_Time *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
time_isoformat(PyDateTime_Time *self)
|
time_isoformat(PyDateTime_Time *self, PyObject *unused)
|
||||||
{
|
{
|
||||||
char buf[100];
|
char buf[100];
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
|
@ -3411,7 +3411,7 @@ time_reduce(PyDateTime_Time *self, PyObject *arg)
|
||||||
|
|
||||||
static PyMethodDef time_methods[] = {
|
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]"
|
PyDoc_STR("Return string in ISO 8601 format, HH:MM:SS[.mmmmmm]"
|
||||||
"[+HH:MM].")},
|
"[+HH:MM].")},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue