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

Remove re.template() and re.TEMPLATE #91367

Closed
serhiy-storchaka opened this issue Apr 4, 2022 · 2 comments
Closed

Remove re.template() and re.TEMPLATE #91367

serhiy-storchaka opened this issue Apr 4, 2022 · 2 comments
Labels
3.11 only security fixes stdlib Python modules in the Lib dir topic-regex type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

BPO 47211
Nosy @ezio-melotti, @serhiy-storchaka, @animalize
PRs
  • bpo-47211: Remove function re.template() and flag re.TEMPLATE #32300
  • 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 2022-04-06.17:04:13.978>
    created_at = <Date 2022-04-04.08:56:13.302>
    labels = ['expert-regex', 'type-feature', 'library', '3.11']
    title = 'Remove re.template() and re.TEMPLATE'
    updated_at = <Date 2022-04-06.17:04:13.978>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2022-04-06.17:04:13.978>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-04-06.17:04:13.978>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)', 'Regular Expressions']
    creation = <Date 2022-04-04.08:56:13.302>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 47211
    keywords = ['patch']
    message_count = 2.0
    messages = ['416658', '416884']
    nosy_count = 4.0
    nosy_names = ['ezio.melotti', 'mrabarnett', 'serhiy.storchaka', 'malin']
    pr_nums = ['32300']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue47211'
    versions = ['Python 3.11']

    @serhiy-storchaka
    Copy link
    Member Author

    They were added in 436c3d5 (between 1.6a2 and 2.0), but the purpose is not known. See also https://mail.python.org/archives/list/python-dev@python.org/message/DVSQGM5LO4TK63C63H6KQ6XBTBQGFLEN/. The feature was not fully implemented, and it was disabled short time later in 29c4ba9. Currently the only effect of this flag is that repetition operators (+, *, ?, {}) do not work. A comment was added in 3562f11:

    SRE_FLAG_TEMPLATE = 1 # template mode (disable backtracking)

    It's all. I guess it could have some relation to possessive repetition operators, except that it is a global flag.

    I think it should be removed without deprecation because it never really worked and never was documented.

    @serhiy-storchaka serhiy-storchaka added 3.11 only security fixes stdlib Python modules in the Lib dir topic-regex type-feature A feature request or enhancement labels Apr 4, 2022
    @serhiy-storchaka
    Copy link
    Member Author

    New changeset b09184b by Serhiy Storchaka in branch 'main':
    bpo-47211: Remove function re.template() and flag re.TEMPLATE (GH-32300)
    b09184b

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    jwilk added a commit to jwilk/pydiatra that referenced this issue May 11, 2022
    re.template() was removed in Python 3.11:
    python/cpython#91367
    
    The function is so obscure, it's not worth supporting.
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes stdlib Python modules in the Lib dir topic-regex type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant