Skip to content

Commit

Permalink
fix: runpy.run_path(path) crashes with pathlib.Path
Browse files Browse the repository at this point in the history
  • Loading branch information
askhl committed Jul 18, 2024
1 parent 45cde52 commit 2d1eabd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions coverage/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ def source_for_file(filename: str) -> str:
file to attribute it to.
"""
from pathlib import Path
filename = str(Path(filename))

if filename.endswith(".py"):
# .py files are themselves source files.
return filename
Expand Down

0 comments on commit 2d1eabd

Please sign in to comment.