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

BytesWarning in re module when compiling certain bytes patterns #75079

Closed
JelleZijlstra opened this issue Jul 10, 2017 · 2 comments
Closed

BytesWarning in re module when compiling certain bytes patterns #75079

JelleZijlstra opened this issue Jul 10, 2017 · 2 comments
Labels
stdlib Python modules in the Lib dir

Comments

@JelleZijlstra
Copy link
Member

BPO 30896
Nosy @ezio-melotti, @serhiy-storchaka, @JelleZijlstra

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 2017-07-11.02:11:08.731>
created_at = <Date 2017-07-10.23:27:55.351>
labels = ['library']
title = 'BytesWarning in re module when compiling certain bytes patterns'
updated_at = <Date 2017-07-11.02:11:08.729>
user = 'https://github.com/JelleZijlstra'

bugs.python.org fields:

activity = <Date 2017-07-11.02:11:08.729>
actor = 'serhiy.storchaka'
assignee = 'none'
closed = True
closed_date = <Date 2017-07-11.02:11:08.731>
closer = 'serhiy.storchaka'
components = ['Library (Lib)']
creation = <Date 2017-07-10.23:27:55.351>
creator = 'JelleZijlstra'
dependencies = []
files = []
hgrepos = []
issue_num = 30896
keywords = []
message_count = 2.0
messages = ['298095', '298100']
nosy_count = 3.0
nosy_names = ['ezio.melotti', 'serhiy.storchaka', 'JelleZijlstra']
pr_nums = []
priority = 'normal'
resolution = 'out of date'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue30896'
versions = ['Python 3.6']

@JelleZijlstra
Copy link
Member Author

This code in sre_parse (line 738 and down):

                        warnings.warn(
                            'Flags not at the start of the expression %s%s' % (
                                source.string[:20],  # truncate long regexes
                                ' (truncated)' if len(source.string) > 20 else '',
                            ),
                            DeprecationWarning, stacklevel=7
                        )

triggers a BytesWarning if you do _line_re = re.compile(br'^(.*?)$(?m)').

The fix should be simple; I can try to get a PR in over the next few days.

@JelleZijlstra JelleZijlstra added the stdlib Python modules in the Lib dir label Jul 10, 2017
@serhiy-storchaka
Copy link
Member

Thank you for your report Jelle, but this was fixed in bpo-30605.

@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
Projects
None yet
Development

No branches or pull requests

2 participants