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.MULTILINE is erroneously passed as the count positional argument in re.sub #60

Open
asottile-sentry opened this issue Nov 13, 2024 · 0 comments · May be fixed by #61
Open

re.MULTILINE is erroneously passed as the count positional argument in re.sub #60

asottile-sentry opened this issue Nov 13, 2024 · 0 comments · May be fixed by #61

Comments

@asottile-sentry
Copy link

in python 3.13 with warnings enabled this becomes an error:

.venv/lib/python3.13/site-packages/email_reply_parser/__init__.py:32: in parse_reply
    return EmailReplyParser.read(text).reply
.venv/lib/python3.13/site-packages/email_reply_parser/__init__.py:22: in read
    return EmailMessage(text).read()
.venv/lib/python3.13/site-packages/email_reply_parser/__init__.py:68: in read
    self.text = re.sub('([^\n])(?=\n ?[_-]{7,})', '\\1\n', self.text, re.MULTILINE)
/opt/hostedtoolcache/Python/3.13.0/x64/lib/python3.13/re/__init__.py:203: in sub
    warnings.warn(
E   DeprecationWarning: 'count' is passed as positional argument

the code clearly didn't intend to do what it's doing -- right now it's passing count=8 because re.MULTILINE has the integer value 8

I think the parameter can be dropped entirely since the regex used does not utilize ^ or $ (which is what MULTILINE changes the behaviour of)

@asottile-sentry asottile-sentry linked a pull request Nov 13, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant