Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re module fails to handle byte strings #47109

Closed
scoder opened this issue May 15, 2008 · 4 comments
Closed

re module fails to handle byte strings #47109

scoder opened this issue May 15, 2008 · 4 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@scoder
Copy link
Contributor

scoder commented May 15, 2008

BPO 2860
Nosy @pitrou, @scoder, @benjaminp

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2008-08-01.10:46:34.004>
created_at = <Date 2008-05-15.08:08:07.113>
labels = ['type-bug', 'library']
title = 're module fails to handle byte strings'
updated_at = <Date 2008-08-01.10:46:34.002>
user = 'https://github.com/scoder'

bugs.python.org fields:

activity = <Date 2008-08-01.10:46:34.002>
actor = 'pitrou'
assignee = 'none'
closed = True
closed_date = <Date 2008-08-01.10:46:34.004>
closer = 'pitrou'
components = ['Library (Lib)']
creation = <Date 2008-05-15.08:08:07.113>
creator = 'scoder'
dependencies = []
files = []
hgrepos = []
issue_num = 2860
keywords = []
message_count = 4.0
messages = ['66848', '66879', '67134', '70549']
nosy_count = 3.0
nosy_names = ['pitrou', 'scoder', 'benjamin.peterson']
pr_nums = []
priority = 'normal'
resolution = 'duplicate'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue2860'
versions = ['Python 3.0']

@scoder
Copy link
Contributor Author

scoder commented May 15, 2008

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".

@scoder scoder added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels May 15, 2008
@benjaminp
Copy link
Contributor

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.

@scoder
Copy link
Contributor Author

scoder commented May 20, 2008

Ah, I now see what the actual problem is. Byte strings return the byte
value on indexing.

Changing the title accordingly.

@scoder scoder changed the title re module fails to handle digits in byte strings re module fails to handle byte strings May 20, 2008
@pitrou
Copy link
Member

pitrou commented Aug 1, 2008

This is a duplicate of bpo-3231 and was fixed in r65185.

@pitrou pitrou closed this as completed Aug 1, 2008
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants