[New-bugs-announce] [issue5236] time.strptime should reject bytes arguments on Py3
Ezio Melotti
report at bugs.python.org
Thu Feb 12 23:50:34 CET 2009
New submission from Ezio Melotti <ezio.melotti at gmail.com>:
On Python3 time.strptime(string[, format]) accepts bytes as arguments
and then fails:
>>> strptime(b"2009", "%Y")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Programs\Python30\lib\_strptime.py", line 454, in _strptime_time
return _strptime(data_string, format)[0]
File "C:\Programs\Python30\lib\_strptime.py", line 322, in _strptime
found = format_regex.match(data_string)
TypeError: can't use a string pattern on a bytes-like object
time.strftime already rejects bytes arguments:
>>> strftime(b'%Y')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: strftime() argument 1 must be str, not bytes
time.strptime should do the same and reject bytes for both the arguments
(string and format).
(With Py2.x both str and unicode args work.)
----------
components: Library (Lib), Unicode
messages: 81834
nosy: ezio.melotti
severity: normal
status: open
title: time.strptime should reject bytes arguments on Py3
type: behavior
versions: Python 3.0, Python 3.1
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5236>
_______________________________________
More information about the New-bugs-announce
mailing list