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
3f94cbf9
Kaydet (Commit)
3f94cbf9
authored
Tem 15, 2012
tarafından
Nick Coghlan
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Actually initialize __main__.__loader__ with loader instances, not the corresponding type objects
üst
8dbe5b55
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
test_cmd_line_script.py
Lib/test/test_cmd_line_script.py
+2
-1
pythonrun.c
Python/pythonrun.c
+6
-2
No files found.
Lib/test/test_cmd_line_script.py
Dosyayı görüntüle @
3f94cbf9
...
...
@@ -37,7 +37,8 @@ f()
assertEqual(result, ['Top level assignment', 'Lower level reference'])
# Check population of magic variables
assertEqual(__name__, '__main__')
_loader = __loader__ if isinstance(__loader__, type) else type(__loader__)
from importlib.machinery import BuiltinImporter
_loader = __loader__ if __loader__ is BuiltinImporter else type(__loader__)
print('__loader__==
%
a'
%
_loader)
print('__file__==
%
a'
%
__file__)
assertEqual(__cached__, None)
...
...
Python/pythonrun.c
Dosyayı görüntüle @
3f94cbf9
...
...
@@ -1355,11 +1355,15 @@ set_main_loader(PyObject *d, const char *filename, const char *loader_name)
{
PyInterpreterState
*
interp
;
PyThreadState
*
tstate
;
PyObject
*
loader
;
PyObject
*
loader
_type
,
*
loader
;
/* Get current thread state and interpreter pointer */
tstate
=
PyThreadState_GET
();
interp
=
tstate
->
interp
;
loader
=
PyObject_GetAttrString
(
interp
->
importlib
,
loader_name
);
loader_type
=
PyObject_GetAttrString
(
interp
->
importlib
,
loader_name
);
if
(
loader_type
==
NULL
)
{
return
-
1
;
}
loader
=
PyObject_CallFunction
(
loader_type
,
"ss"
,
"__main__"
,
filename
);
if
(
loader
==
NULL
||
(
PyDict_SetItemString
(
d
,
"__loader__"
,
loader
)
<
0
))
{
return
-
1
;
...
...
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