Skip to content

Commit

Permalink
Make C TimeStamp ctor match Python ref. impl.
Browse files Browse the repository at this point in the history
'h', 'm', and 'sec' arguments to 'TimeStamp' are now non-optional.  This
change matches Python implementation, and ZODB does not use the flexibility.

Fixes #13.
  • Loading branch information
tseaver committed Nov 28, 2014
1 parent d617be8 commit be7fde0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
4.0.9 (unreleased)
------------------

- TBD
- Make ``h``, ``m``, and ``sec`` arguments to C implementation of
``TimeStamp`` non-optional (matches Python implementation, and ZODB
does not use the flexibility). Issue #13.

4.0.8 (2014-03-20)
------------------
Expand Down
2 changes: 1 addition & 1 deletion persistent/_timestamp.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ TimeStamp_TimeStamp(PyObject *obj, PyObject *args)
}
PyErr_Clear();

if (!PyArg_ParseTuple(args, "iii|iid", &y, &mo, &d, &h, &m, &sec))
if (!PyArg_ParseTuple(args, "iiiiid", &y, &mo, &d, &h, &m, &sec))
return NULL;
return TimeStamp_FromDate(y, mo, d, h, m, sec);
}
Expand Down
2 changes: 2 additions & 0 deletions persistent/tests/test_timestamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def test_ctor_invalid_arglist(self):
(1, 2, 3, 4, 5),
('1', '2', '3', '4', '5', '6'),
(1, 2, 3, 4, 5, 6, 7),
# see https://github.com/zopefoundation/persistent/issues/13
(2014, 2, 3)
]
for args in BAD_ARGS:
self.assertRaises((TypeError, ValueError), self._makeOne, *args)
Expand Down

0 comments on commit be7fde0

Please sign in to comment.