Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
194bcaf4
Kaydet (Commit)
194bcaf4
authored
Haz 12, 2014
tarafından
Vinay Sajip
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #21709: Improved implementation to cover the frozen module case.
üst
307bccc6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
28 deletions
+34
-28
__init__.py
Lib/logging/__init__.py
+34
-28
No files found.
Lib/logging/__init__.py
Dosyayı görüntüle @
194bcaf4
...
...
@@ -51,34 +51,6 @@ __date__ = "07 February 2010"
# Miscellaneous module data
#---------------------------------------------------------------------------
#
# _srcfile is used when walking the stack to check when we've got the first
# caller stack frame.
#
if
hasattr
(
sys
,
'frozen'
):
_srcfile
=
os
.
path
.
join
(
'logging'
,
'__init__.py'
)
else
:
_srcfile
=
__file__
_srcfile
=
os
.
path
.
normcase
(
_srcfile
)
if
hasattr
(
sys
,
'_getframe'
):
currentframe
=
lambda
:
sys
.
_getframe
(
3
)
else
:
#pragma: no cover
def
currentframe
():
"""Return the frame object for the caller's stack frame."""
try
:
raise
Exception
except
Exception
:
return
sys
.
exc_info
()[
2
]
.
tb_frame
.
f_back
# _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
# findCaller() from being called.
#if not hasattr(sys, "_getframe"):
# _srcfile = None
#
#_startTime is used as the base when calculating the relative time of events
#
...
...
@@ -172,6 +144,40 @@ def addLevelName(level, levelName):
finally
:
_releaseLock
()
if
hasattr
(
sys
,
'_getframe'
):
currentframe
=
lambda
:
sys
.
_getframe
(
3
)
else
:
#pragma: no cover
def
currentframe
():
"""Return the frame object for the caller's stack frame."""
try
:
raise
Exception
except
Exception
:
return
sys
.
exc_info
()[
2
]
.
tb_frame
.
f_back
#
# _srcfile is used when walking the stack to check when we've got the first
# caller stack frame, by skipping frames whose filename is that of this
# module's source. It therefore should contain the filename of this module's
# source file.
#
# Ordinarily we would use __file__ for this, but frozen modules don't always
# have __file__ set, for some reason (see Issue #21736). Thus, we get the
# filename from a handy code object from a function defined in this module.
# (There's no particular reason for picking addLevelName.)
#
_srcfile
=
os
.
path
.
normcase
(
addLevelName
.
__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
# findCaller() from being called. You can also do this if you want to avoid
# the overhead of fetching caller information, even when _getframe() is
# available.
#if not hasattr(sys, '_getframe'):
# _srcfile = None
def
_checkLevel
(
level
):
if
isinstance
(
level
,
int
):
rv
=
level
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment