Issue 2860: re module fails to handle byte strings
Issue2860
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.
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) * ![]() |
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) * ![]() |
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) * ![]() |
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) * ![]() |
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:34 | admin | set | github: 47109 |
| 2008-08-01 10:46:34 | pitrou | set | status: open -> closed resolution: duplicate messages: + msg70549 nosy: + pitrou |
| 2008-05-20 16:28:11 | scoder | set | messages:
+ msg67134 title: re module fails to handle digits in byte strings -> re module fails to handle byte strings |
| 2008-05-15 21:40:09 | benjamin.peterson | set | nosy:
+ benjamin.peterson messages: + msg66879 |
| 2008-05-15 08:08:07 | scoder | create | |
