11# -*- coding: utf-8 -*-
2- # Copyright (C) 2008-2010, 2013-2020 Rocky Bernstein <rocky@gnu.org>
2+ # Copyright (C) 2008-2010, 2013-2021 Rocky Bernstein <rocky@gnu.org>
33#
44# This program is free software: you can redistribute it and/or modify
55# it under the terms of the GNU General Public License as published by
@@ -207,7 +207,9 @@ def print_location(proc_obj):
207207 filename = pyficache .unmap_file (filename )
208208 if "<string>" == filename :
209209 remapped = cmdfns .source_tempfile_remap (
210- "eval_string" , dbgr_obj .eval_string
210+ "eval_string" ,
211+ dbgr_obj .eval_string ,
212+ tempdir = proc_obj .settings ("tempdir" ),
211213 )
212214 pyficache .remap_file (filename , remapped )
213215 filename , lineno = pyficache .unmap_file_line (filename , lineno )
@@ -230,7 +232,9 @@ def print_location(proc_obj):
230232 pass
231233 pass
232234 elif pyficache .main .remap_re_hash :
233- remapped_file = pyficache .remap_file_pat (filename , pyficache .main .remap_re_hash )
235+ remapped_file = pyficache .remap_file_pat (
236+ filename , pyficache .main .remap_re_hash
237+ )
234238 elif m and m .group (1 ) in sys .modules :
235239 remapped_file = m .group (1 )
236240 pyficache .remap_file (filename , remapped_file )
@@ -255,7 +259,10 @@ def print_location(proc_obj):
255259 # Deparse the code object into a temp file and remap the line from code
256260 # into the corresponding line of the tempfile
257261 co = proc_obj .curframe .f_code
258- temp_filename , name_for_code = deparse_and_cache (co , proc_obj .errmsg )
262+ tempdir = proc_obj .settings ("tempdir" )
263+ temp_filename , name_for_code = deparse_and_cache (
264+ co , proc_obj .errmsg , tempdir = tempdir
265+ )
259266 lineno = 1
260267 # _, lineno = pyficache.unmap_file_line(temp_filename, lineno, True)
261268 if temp_filename :
@@ -275,7 +282,10 @@ def print_location(proc_obj):
275282 # FIXME: DRY code with version in cmdproc.py print_location
276283 prefix = osp .basename (temp_name ).split ("." )[0 ]
277284 fd = tempfile .NamedTemporaryFile (
278- suffix = ".py" , prefix = prefix , delete = False
285+ suffix = ".py" ,
286+ prefix = prefix ,
287+ delete = False ,
288+ dir = proc_obj .settings ("tempdir" ),
279289 )
280290 with fd :
281291 fd .write ("" .join (lines ).encode ("utf-8" ))
@@ -343,7 +353,10 @@ def print_location(proc_obj):
343353 val = proc_obj .event_arg
344354 intf_obj .msg ("R=> %s" % proc_obj ._saferepr (val ))
345355 pass
346- elif proc_obj .event == "call" and proc_obj .curframe .f_locals .get ("__name__" , "" ) != "__main__" :
356+ elif (
357+ proc_obj .event == "call"
358+ and proc_obj .curframe .f_locals .get ("__name__" , "" ) != "__main__"
359+ ):
347360 try :
348361 proc_obj .commands ["info" ].run (["info" , "locals" ])
349362 except :
@@ -450,8 +463,8 @@ def add_remap_pat(self, pat, replace, clear_remap=True):
450463 self .remap_re_hash [re .compile (pat )] = (pat , replace )
451464 pyficache .main .add_remap_pat (pat , replace , clear_remap )
452465 if clear_remap :
453- self .file2file_remap = {}
454- pyficache .file2file_remap = {}
466+ self .file2file_remap = {}
467+ pyficache .file2file_remap = {}
455468
456469 # To be overridden in derived debuggers
457470 def defaultFile (self ):
0 commit comments