← 返回首页
AttributeError when copying flags in the `re` module. · Issue #93820 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

AttributeError when copying flags in the re module. #93820

New issue
New issue

Description

Bug report

In CPython 3.11, I've noticed that an attempt to copy (combined) regular expression flags fails with an attribute error; like so:

>>> import copy, re >>> copy.copy(re.A | re.I) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "lib/python3.11/copy.py", line 102, in copy return _reconstruct(x, None, *rv) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "lib/python3.11/copy.py", line 265, in _reconstruct y = func(*args) ^^^^^^^^^^^ File "lib/python3.11/enum.py", line 862, in __getattr__ raise AttributeError(name) from None ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: ASCII|IGNORECASE

Your environment

  • CPython versions tested on: 3.11.0b3
  • Operating system and architecture: macOS 10.15.7

Background

This behavior was detected from a CrossHair test failure here, in which we realize possibly symbolic arguments prior to regex compilation. (it's an esoteric use case, and I expect not very high priority)

Metadata

Metadata

Assignees

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

  • Open in GitHub Copilot app

Footer

© 2026 GitHub, Inc.