backport: fix trace.py --ignore-dir
diff --git a/Lib/trace.py b/Lib/trace.py
index 35edac2..364e3f7 100644
--- a/Lib/trace.py
+++ b/Lib/trace.py
@@ -587,7 +587,7 @@
         """
         if why == 'call':
             code = frame.f_code
-            filename = code.co_filename
+            filename = frame.f_globals.get('__file__', None)
             if filename:
                 # XXX modname() doesn't work right for packages, so
                 # the ignore support won't work right for packages