# --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: package/*/python/hotfix-regex.patch # Copyright (C) 2022 The T2 SDE Project # # This Copyright note is generated by scripts/Create-CopyPatch, # more information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License version 2 as used by the T2 SDE. # --- T2-COPYRIGHT-NOTE-END --- --- Python-3.11.0/Lib/re/_parser.py.vanilla 2022-10-27 11:22:46.814068692 +0200 +++ Python-3.11.0/Lib/re/_parser.py 2022-10-27 11:26:27.325086309 +0200 @@ -838,9 +838,16 @@ flags = _parse_flags(source, state, char) if flags is None: # global flags if not first or subpattern: - raise source.error('global flags not at the start ' - 'of the expression', - source.tell() - start) + import warnings + warnings.warn( + 'Flags not at the start of the expression %r%s' + ' but at position %d' % ( + source.string[:20], # truncate long regexes + ' (truncated)' if len(source.string) > 20 else '', + start, + ), + DeprecationWarning, stacklevel=nested + 6 + ) verbose = state.flags & SRE_FLAG_VERBOSE continue