summaryrefslogtreecommitdiff
path: root/Lib/logging
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/__init__.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index bd4afeb1aa..2c0f14f5b0 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -59,18 +59,6 @@ try:
except NameError:
_unicode = False
-#
-# _srcfile is used when walking the stack to check when we've got the first
-# caller stack frame.
-#
-if hasattr(sys, 'frozen'): #support for py2exe
- _srcfile = "logging%s__init__%s" % (os.sep, __file__[-4:])
-elif __file__[-4:].lower() in ['.pyc', '.pyo']:
- _srcfile = __file__[:-4] + '.py'
-else:
- _srcfile = __file__
-_srcfile = os.path.normcase(_srcfile)
-
# next bit filched from 1.5.2's inspect.py
def currentframe():
"""Return the frame object for the caller's stack frame."""
@@ -82,6 +70,12 @@ def currentframe():
if hasattr(sys, '_getframe'): currentframe = lambda: sys._getframe(3)
# done filching
+#
+# _srcfile is used when walking the stack to check when we've got the first
+# caller stack frame.
+#
+_srcfile = currentframe.__code__.co_filename
+
# _srcfile is only used in conjunction with sys._getframe().
# To provide compatibility with older versions of Python, set _srcfile
# to None if _getframe() is not available; this value will prevent