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

gh-105687: Remove deprecated objects from re module #105688

Merged
merged 3 commits into from
Jun 14, 2023

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Jun 12, 2023

@sobolevn sobolevn requested a review from vstinner June 12, 2023 12:24
@vstinner
Copy link
Member

I already proposed to remove these APIs directly, without deprecation period. But @serhiy-storchaka wanted to collect feedback of users with a deprecation period. So far, I am not aware of any feedback.

This feature can be reimplemented outside Python stdlib if needed, no?

* Remove deprecated ``re.template`` function
and ``re.T`` and ``re.TEMPLATE`` flags.
Also removes ``SRE_FLAG_TEMPLATE`` constant
from ``sre_constants`` and ``re._constants``.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain how to update existing code. I suppose that replacing re.template() with re.compile() works in most cases, no?

Please mention also that the flag never worked, see the previous removal commit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that these who use it should find how to replace it themselves. It cannot just be replaced with re.compile(), otherwise they would use re.compile() at first place. Perhaps.

and ``re.T`` and ``re.TEMPLATE`` flags.
Also removes ``SRE_FLAG_TEMPLATE`` constant
from ``sre_constants`` and ``re._constants``.
(Contributed by Nikita Sobolev in :gh:`105687`.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to credit Serhiy who attempted first to remove it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course!

Copy link
Member Author

@sobolevn sobolevn Jun 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added Serhiy as the first name in the name tuple 👍

@vstinner
Copy link
Member

cc @hugovk

* Remove deprecated ``re.template`` function
and ``re.T`` and ``re.TEMPLATE`` flags.
Also removes ``SRE_FLAG_TEMPLATE`` constant
from ``sre_constants`` and ``re._constants``.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that these who use it should find how to replace it themselves. It cannot just be replaced with re.compile(), otherwise they would use re.compile() at first place. Perhaps.

@serhiy-storchaka
Copy link
Member

I already proposed to remove these APIs directly, without deprecation period. But @serhiy-storchaka wanted to collect feedback of users with a deprecation period.

Actually, I initially removed it without deprecation, because it clearly looked to me as unfinished in process of initial implementation and later broken feature.

My best guess is that it was purposed to make all quntifiers possessive. But initial implementation of atomic groups and possessive quantifiers was broken. Now we have working implementation, and can enable that feature. To disable backtracking it would need also wrap every alternation into atomic group. We can do this now if it was initial purpose, but I have no idea why somebody would need such feature.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the enhanced doc.

@vstinner vstinner merged commit 67f69db into python:main Jun 14, 2023
@vstinner
Copy link
Member

Merged, thanks.

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 this pull request may close these issues.

None yet

4 participants