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
a62207c5
Kaydet (Commit)
a62207c5
authored
Agu 07, 2010
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #9425: Create run_command() subfunction
Use PyUnicode_AsUTF8String() instead of _PyUnicode_AsString()
üst
6c6f851e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
15 deletions
+23
-15
main.c
Modules/main.c
+23
-15
No files found.
Modules/main.c
Dosyayı görüntüle @
a62207c5
...
@@ -253,6 +253,28 @@ static int RunMainFromImporter(wchar_t *filename)
...
@@ -253,6 +253,28 @@ static int RunMainFromImporter(wchar_t *filename)
}
}
}
}
static
int
run_command
(
wchar_t
*
command
,
PyCompilerFlags
*
cf
)
{
PyObject
*
unicode
,
*
bytes
;
int
ret
;
unicode
=
PyUnicode_FromWideChar
(
command
,
-
1
);
if
(
unicode
==
NULL
)
goto
error
;
bytes
=
PyUnicode_AsUTF8String
(
unicode
);
Py_DECREF
(
unicode
);
if
(
bytes
==
NULL
)
goto
error
;
ret
=
PyRun_SimpleStringFlags
(
PyBytes_AsString
(
bytes
),
cf
);
Py_DECREF
(
bytes
);
return
ret
!=
0
;
error:
PyErr_Print
();
return
1
;
}
/* Main program */
/* Main program */
...
@@ -564,22 +586,8 @@ Py_Main(int argc, wchar_t **argv)
...
@@ -564,22 +586,8 @@ Py_Main(int argc, wchar_t **argv)
}
}
if
(
command
)
{
if
(
command
)
{
char
*
commandStr
;
sts
=
run_command
(
command
,
&
cf
);
PyObject
*
commandObj
=
PyUnicode_FromWideChar
(
command
,
wcslen
(
command
));
free
(
command
);
free
(
command
);
if
(
commandObj
!=
NULL
)
commandStr
=
_PyUnicode_AsString
(
commandObj
);
else
commandStr
=
NULL
;
if
(
commandStr
!=
NULL
)
{
sts
=
PyRun_SimpleStringFlags
(
commandStr
,
&
cf
)
!=
0
;
Py_DECREF
(
commandObj
);
}
else
{
PyErr_Print
();
sts
=
1
;
}
}
else
if
(
module
)
{
}
else
if
(
module
)
{
sts
=
RunModule
(
module
,
1
);
sts
=
RunModule
(
module
,
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