-
Notifications
You must be signed in to change notification settings - Fork 71
Description
Python 3.6 is creating a breaking change to the way re.sub() works, in that any unknown escape sequence in the repl parameter (a backslash followed by any ASCII letter) becomes a runtime exception.
This commit fixes the particular case that was causing the unit tests in Travis CI to fail under Python 3.6.0a2 (nightly build).
In normal (non-UTF8) operation of RiveScript it should be difficult to trigger a similar exception, but with UTF-8 mode enabled and specially crafted RiveScript source files it could become possible to crash the library.
Every instance of re.sub() should be visited to make sure that no escape sequence will ever appear as the repl parameter that will cause a runtime crash of the program. Even if the user disables strict mode.
See also: https://docs.python.org/3.6/library/re.html#re.sub
Changed in version 3.6: Unknown escapes consisting of
'\'and an ASCII letter now are errors.
Python 3.6 is set for release on December 12, 2016 and RiveScript should be ready for it before then.