Raise re2.error instead of crashing.

Fixes #484.

Change-Id: I152b5ed8a6358d2d74f553bde2e66f2e50cfba1d
Reviewed-on: https://code-review.googlesource.com/c/re2/+/62890
Reviewed-by: Alex Chernyakhovsky <achernya@google.com>
Reviewed-by: Paul Wankadia <junyer@google.com>
This commit is contained in:
Paul Wankadia
2024-03-17 13:23:12 +00:00
parent db46d1e11e
commit 1250a99301
3 changed files with 17 additions and 2 deletions

View File

@@ -33,8 +33,9 @@ import itertools
import _re2
class error(Exception):
pass
# pybind11 translates C++ exceptions to Python exceptions.
# We use that same Python exception class for consistency.
error = _re2.Error
class Options(_re2.RE2.Options):