summaryrefslogtreecommitdiffstats
path: root/Lib/profile.py
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2020-10-18 20:48:31 (GMT)
committerGitHub <noreply@github.com>2020-10-18 20:48:31 (GMT)
commit3c0ac18504cfeed822439024339d5717f42bdd66 (patch)
tree5856fb42353bd419b9c39f6d2790dec194f3d5fc /Lib/profile.py
parentb81c833ab51fb7d7f0f8eaace37f60ef7455aa85 (diff)
downloadcpython-3c0ac18504cfeed822439024339d5717f42bdd66.zip
cpython-3c0ac18504cfeed822439024339d5717f42bdd66.tar.gz
cpython-3c0ac18504cfeed822439024339d5717f42bdd66.tar.bz2
bpo-40492: Fix --outfile with relative path when the program changes it working dir (GH-19910)
Diffstat (limited to 'Lib/profile.py')
-rwxr-xr-xLib/profile.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/profile.py b/Lib/profile.py
index aad458d..5cb017ed 100755
--- a/Lib/profile.py
+++ b/Lib/profile.py
@@ -571,6 +571,11 @@ def main():
(options, args) = parser.parse_args()
sys.argv[:] = args
+ # The script that we're profiling may chdir, so capture the absolute path
+ # to the output file at startup.
+ if options.outfile is not None:
+ options.outfile = os.path.abspath(options.outfile)
+
if len(args) > 0:
if options.module:
import runpy