-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Open
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtopic-regextype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
import re
data = bytearray(b'1')
match = re.match(b'1', data)
print(match[0]) # b'1'
data[:] = b'2'
print(match[0]) # b'2'If you match against mutable data (e.g., a bytearray) and change that data after matching, the matched values reported by the match change.
Is this a) a bug or b) strange behavior that should be pointed out in the docs (or c) none of the above)?
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Metadata
Metadata
Assignees
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtopic-regextype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error