Add some assertion for input of replace_ext()

This commit is contained in:
Pierre Ayoub 2024-04-14 17:09:44 +02:00 committed by Pierre Ayoub
parent e3e47618f9
commit ddddddfdb3
No known key found for this signature in database
GPG key ID: B1AF6307DB5EB778

View file

@ -49,6 +49,8 @@ def replace_ext(path, ext):
The new extension must not contain a leading dot.
"""
assert isinstance(path, bytes)
assert isinstance(ext, bytes)
ext_dot = b"." + ext
return os.path.splitext(path)[0] + ext_dot