This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: re module fails to handle byte strings
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.0
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, pitrou, scoder
Priority: normal Keywords:

Created on 2008-05-15 08:08 by scoder, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg66848 - (view) Author: Stefan Behnel (scoder) * (Python committer) Date: 2008-05-15 08:08
The following fails in Py3.0a5:

    >>> import re
    >>> re.search(b'(\d+)', b'-2.80 98\n')

I get a TypeError: "Can't convert 'int' object to str implicitly" in
line 204 of file "sre_parse.py", code being "char = char + c".
msg66879 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-05-15 21:40
I think it's debatable whether re should byte strings since it is
searching through text and not raw binary data. However, this may be a
case of practicality over purity.
msg67134 - (view) Author: Stefan Behnel (scoder) * (Python committer) Date: 2008-05-20 16:27
Ah, I now see what the actual problem is. Byte strings return the byte
value on indexing.

Changing the title accordingly.
msg70549 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-08-01 10:46
This is a duplicate of #3231 and was fixed in r65185.
History
Date User Action Args
2022-04-11 14:56:34adminsetgithub: 47109
2008-08-01 10:46:34pitrousetstatus: open -> closed
resolution: duplicate
messages: + msg70549
nosy: + pitrou
2008-05-20 16:28:11scodersetmessages: + msg67134
title: re module fails to handle digits in byte strings -> re module fails to handle byte strings
2008-05-15 21:40:09benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg66879
2008-05-15 08:08:07scodercreate