Removes a copy going from bytearray to bytes.
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
# less significant byte is a bit index in the chunk (just like the
# CHARSET matching).
- charmap = bytes(charmap) # should be hashable
+ charmap = charmap.take_bytes() # should be hashable
comps = {}
mapping = bytearray(256)
block = 0
--- /dev/null
+Remove data copy from :mod:`re` compilation of regexes with large charsets
+by using :meth:`bytearray.take_bytes`.