diff options
| author | Antoine Pitrou <solipsis@pitrou.net> | 2008-08-19 17:56:33 +0000 |
|---|---|---|
| committer | Antoine Pitrou <solipsis@pitrou.net> | 2008-08-19 17:56:33 +0000 |
| commit | fd036451bf0e0ade8783e21df801abf7be96d020 (patch) | |
| tree | e70ff65a9e641d8e790bc091f0dc2507baf344ca /Lib/distutils | |
| parent | 3ad7ba10a20827b24d4b1aa9dd49474db8affbdd (diff) | |
| download | cpython-git-fd036451bf0e0ade8783e21df801abf7be96d020.tar.gz | |
#2834: Change re module semantics, so that str and bytes mixing is forbidden,
and str (unicode) patterns get full unicode matching by default. The re.ASCII
flag is also introduced to ask for ASCII matching instead.
Diffstat (limited to 'Lib/distutils')
| -rw-r--r-- | Lib/distutils/cygwinccompiler.py | 6 | ||||
| -rw-r--r-- | Lib/distutils/emxccompiler.py | 2 | ||||
| -rw-r--r-- | Lib/distutils/sysconfig.py | 2 | ||||
| -rw-r--r-- | Lib/distutils/util.py | 2 | ||||
| -rw-r--r-- | Lib/distutils/version.py | 2 | ||||
| -rw-r--r-- | Lib/distutils/versionpredicate.py | 6 |
6 files changed, 11 insertions, 9 deletions
diff --git a/Lib/distutils/cygwinccompiler.py b/Lib/distutils/cygwinccompiler.py index 488752300b..da2c74a2b1 100644 --- a/Lib/distutils/cygwinccompiler.py +++ b/Lib/distutils/cygwinccompiler.py @@ -409,7 +409,7 @@ def get_versions(): out = os.popen(gcc_exe + ' -dumpversion','r') out_string = out.read() out.close() - result = re.search('(\d+\.\d+(\.\d+)*)',out_string) + result = re.search('(\d+\.\d+(\.\d+)*)', out_string, re.ASCII) if result: gcc_version = StrictVersion(result.group(1)) else: @@ -421,7 +421,7 @@ def get_versions(): out = os.popen(ld_exe + ' -v','r') out_string = out.read() out.close() - result = re.search('(\d+\.\d+(\.\d+)*)',out_string) + result = re.search('(\d+\.\d+(\.\d+)*)', out_string, re.ASCII) if result: ld_version = StrictVersion(result.group(1)) else: @@ -433,7 +433,7 @@ def get_versions(): out = os.popen(dllwrap_exe + ' --version','r') out_string = out.read() out.close() - result = re.search(' (\d+\.\d+(\.\d+)*)',out_string) + result = re.search(' (\d+\.\d+(\.\d+)*)', out_string, re.ASCII) if result: dllwrap_version = StrictVersion(result.group(1)) else: diff --git a/Lib/distutils/emxccompiler.py b/Lib/distutils/emxccompiler.py index d9ee82d58a..62a4c5b4e8 100644 --- a/Lib/distutils/emxccompiler.py +++ b/Lib/distutils/emxccompiler.py @@ -300,7 +300,7 @@ def get_versions(): out = os.popen(gcc_exe + ' -dumpversion','r') out_string = out.read() out.close() - result = re.search('(\d+\.\d+\.\d+)',out_string) + result = re.search('(\d+\.\d+\.\d+)', out_string, re.ASCII) if result: gcc_version = StrictVersion(result.group(1)) else: diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py index 3a120dd584..b17743a865 100644 --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -512,7 +512,7 @@ def get_config_vars(*args): # patched up as well. 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): flags = _config_vars[key] - flags = re.sub('-arch\s+\w+\s', ' ', flags) + flags = re.sub('-arch\s+\w+\s', ' ', flags, re.ASCII) flags = re.sub('-isysroot [^ \t]*', ' ', flags) _config_vars[key] = flags diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py index 76798b9506..b87dfbe065 100644 --- a/Lib/distutils/util.py +++ b/Lib/distutils/util.py @@ -81,7 +81,7 @@ def get_platform (): return "%s-%s.%s" % (osname, version, release) elif osname[:6] == "cygwin": osname = "cygwin" - rel_re = re.compile (r'[\d.]+') + rel_re = re.compile (r'[\d.]+', re.ASCII) m = rel_re.match(release) if m: release = m.group() diff --git a/Lib/distutils/version.py b/Lib/distutils/version.py index f71b2f6ce3..907f71c313 100644 --- a/Lib/distutils/version.py +++ b/Lib/distutils/version.py @@ -134,7 +134,7 @@ class StrictVersion (Version): """ version_re = re.compile(r'^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$', - re.VERBOSE) + re.VERBOSE | re.ASCII) def parse (self, vstring): diff --git a/Lib/distutils/versionpredicate.py b/Lib/distutils/versionpredicate.py index 434b34f184..b0dd9f45bf 100644 --- a/Lib/distutils/versionpredicate.py +++ b/Lib/distutils/versionpredicate.py @@ -5,7 +5,8 @@ import distutils.version import operator -re_validPackage = re.compile(r"(?i)^\s*([a-z_]\w*(?:\.[a-z_]\w*)*)(.*)") +re_validPackage = re.compile(r"(?i)^\s*([a-z_]\w*(?:\.[a-z_]\w*)*)(.*)", + re.ASCII) # (package) (rest) re_paren = re.compile(r"^\s*\((.*)\)\s*$") # (list) inside of parentheses @@ -153,7 +154,8 @@ def split_provision(value): global _provision_rx if _provision_rx is None: _provision_rx = re.compile( - "([a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*)(?:\s*\(\s*([^)\s]+)\s*\))?$") + "([a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*)(?:\s*\(\s*([^)\s]+)\s*\))?$", + re.ASCII) value = value.strip() m = _provision_rx.match(value) if not m: |
