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
feaa54f5
Kaydet (Commit)
feaa54f5
authored
Eyl 25, 2012
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
don't depend on __debug__ because it's baked in at freeze time (issue #16046)
üst
d79ac0fa
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
8 deletions
+11
-8
_bootstrap.py
Lib/importlib/_bootstrap.py
+9
-8
NEWS
Misc/NEWS
+2
-0
importlib.h
Python/importlib.h
+0
-0
No files found.
Lib/importlib/_bootstrap.py
Dosyayı görüntüle @
feaa54f5
...
...
@@ -411,25 +411,21 @@ SOURCE_SUFFIXES = ['.py'] # _setup() adds .pyw as needed.
DEBUG_BYTECODE_SUFFIXES
=
[
'.pyc'
]
OPTIMIZED_BYTECODE_SUFFIXES
=
[
'.pyo'
]
if
__debug__
:
BYTECODE_SUFFIXES
=
DEBUG_BYTECODE_SUFFIXES
else
:
BYTECODE_SUFFIXES
=
OPTIMIZED_BYTECODE_SUFFIXES
def
cache_from_source
(
path
,
debug_override
=
None
):
"""Given the path to a .py file, return the path to its .pyc/.pyo file.
The .py file does not need to exist; this simply returns the path to the
.pyc/.pyo file calculated as if the .py file were imported. The extension
will be .pyc unless
__debug__ is not defined
, then it will be .pyo.
will be .pyc unless
sys.flags.optimize is non-zero
, then it will be .pyo.
If debug_override is not None, then it must be a boolean and is taken as
the value of
__debug__
instead.
the value of
bool(sys.flags.optimize)
instead.
If sys.implementation.cache_tag is None then NotImplementedError is raised.
"""
debug
=
__debug__
if
debug_override
is
None
else
debug_override
debug
=
not
sys
.
flags
.
optimize
if
debug_override
is
None
else
debug_override
if
debug
:
suffixes
=
DEBUG_BYTECODE_SUFFIXES
else
:
...
...
@@ -1688,10 +1684,15 @@ def _setup(sys_module, _imp_module):
modules, those two modules must be explicitly passed in.
"""
global
_imp
,
sys
global
_imp
,
sys
,
BYTECODE_SUFFIXES
_imp
=
_imp_module
sys
=
sys_module
if
sys
.
flags
.
optimize
:
BYTECODE_SUFFIXES
=
OPTIMIZED_BYTECODE_SUFFIXES
else
:
BYTECODE_SUFFIXES
=
DEBUG_BYTECODE_SUFFIXES
for
module
in
(
_imp
,
sys
):
if
not
hasattr
(
module
,
'__loader__'
):
module
.
__loader__
=
BuiltinImporter
...
...
Misc/NEWS
Dosyayı görüntüle @
feaa54f5
...
...
@@ -10,6 +10,8 @@ What's New in Python 3.3.1?
Core and Builtins
-----------------
- Issue #16046: Fix loading sourceless legacy pyos.
- Issue #15379: Fix passing of non-BMP characters as integers for the charmap
decoder (already working as unicode strings). Patch by Serhiy Storchaka.
...
...
Python/importlib.h
Dosyayı görüntüle @
feaa54f5
This diff is collapsed.
Click to expand it.
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