Issue #22410: Module level functions in the re module now cache compiled
locale-dependent regular expressions taking into account the locale.
Fixed compile error in issue #22410. The _locale module is optional.