diff options
author | Jonathan Metzman <metzman@chromium.org> | 2021-01-20 12:59:11 -0800 |
---|---|---|
committer | Jonathan Metzman <metzman@chromium.org> | 2021-01-20 12:59:11 -0800 |
commit | 63925e0e0db7abed296ecf520c7269a2101dd738 (patch) | |
tree | 987e55f53a892fe312d0ad5340e066b0555149c5 /infra/utils.py | |
parent | 64aeebf94f9085598305c45b2a13b2796139ff0d (diff) | |
download | oss-fuzz-63925e0e0db7abed296ecf520c7269a2101dd738.tar.gz |
match behavior of removeprefix
Diffstat (limited to 'infra/utils.py')
-rw-r--r-- | infra/utils.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/infra/utils.py b/infra/utils.py index d8ade3891..fe5dd8730 100644 --- a/infra/utils.py +++ b/infra/utils.py @@ -163,4 +163,9 @@ def gs_url_to_https(url): def remove_prefix(string, prefix): """Returns |string| without the leading substring |prefix|.""" - return string[len(prefix):] + # Match behavior of removeprefix from python3.9: + # https://www.python.org/dev/peps/pep-0616/ + if string.startswith(prefix): + return string[len(prefix):] + + return string |