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
b75d7e24
Unverified
Kaydet (Commit)
b75d7e24
authored
Agu 01, 2018
tarafından
Victor Stinner
Kaydeden (comit)
GitHub
Agu 01, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-34170: Add _PyCoreConfig._frozen parameter (GH-8591)
Modify frozenmain.c to use _Py_InitializeFromConfig().
üst
8ed317f1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
8 deletions
+37
-8
pystate.h
Include/pystate.h
+8
-1
test_embed.py
Lib/test/test_embed.py
+4
-0
getpath.c
Modules/getpath.c
+3
-3
main.c
Modules/main.c
+5
-0
_freeze_importlib.c
Programs/_freeze_importlib.c
+1
-2
_testembed.c
Programs/_testembed.c
+6
-0
frozenmain.c
Python/frozenmain.c
+10
-2
No files found.
Include/pystate.h
Dosyayı görüntüle @
b75d7e24
...
...
@@ -235,6 +235,12 @@ typedef struct {
See PEP 552 "Deterministic pycs" for more details. */
const
char
*
_check_hash_pycs_mode
;
/* If greater than 0, suppress _PyPathConfig_Calculate() warnings.
If set to -1 (default), inherit Py_FrozenFlag value. */
int
_frozen
;
}
_PyCoreConfig
;
#ifdef MS_WINDOWS
...
...
@@ -269,7 +275,8 @@ typedef struct {
.user_site_directory = -1, \
.unbuffered_stdio = -1, \
_PyCoreConfig_WINDOWS_INIT \
._install_importlib = 1}
._install_importlib = 1, \
._frozen = -1}
/* Note: _PyCoreConfig_INIT sets other fields to 0/NULL */
/* Placeholders while working on the new configuration API
...
...
Lib/test/test_embed.py
Dosyayı görüntüle @
b75d7e24
...
...
@@ -289,6 +289,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
'_install_importlib'
:
1
,
'_check_hash_pycs_mode'
:
'default'
,
'_frozen'
:
0
,
}
def
check_config
(
self
,
testname
,
expected
):
...
...
@@ -330,6 +331,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
'unbuffered_stdio'
:
1
,
'utf8_mode'
:
1
,
'user_site_directory'
:
0
,
'_frozen'
:
1
,
}
self
.
check_config
(
"init_global_config"
,
config
)
...
...
@@ -362,7 +364,9 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
'unbuffered_stdio'
:
1
,
'user_site_directory'
:
0
,
'faulthandler'
:
1
,
'_check_hash_pycs_mode'
:
'always'
,
'_frozen'
:
1
,
}
self
.
check_config
(
"init_from_config"
,
config
)
...
...
Modules/getpath.c
Dosyayı görüntüle @
b75d7e24
...
...
@@ -372,7 +372,7 @@ calculate_prefix(const _PyCoreConfig *core_config,
{
calculate
->
prefix_found
=
search_for_prefix
(
core_config
,
calculate
,
prefix
);
if
(
!
calculate
->
prefix_found
)
{
if
(
!
Py_FrozenFlag
)
{
if
(
!
core_config
->
_frozen
)
{
fprintf
(
stderr
,
"Could not find platform independent libraries <prefix>
\n
"
);
}
...
...
@@ -495,7 +495,7 @@ calculate_exec_prefix(const _PyCoreConfig *core_config,
calculate
,
exec_prefix
);
if
(
!
calculate
->
exec_prefix_found
)
{
if
(
!
Py_FrozenFlag
)
{
if
(
!
core_config
->
_frozen
)
{
fprintf
(
stderr
,
"Could not find platform dependent libraries <exec_prefix>
\n
"
);
}
...
...
@@ -915,7 +915,7 @@ calculate_path_impl(const _PyCoreConfig *core_config,
calculate_exec_prefix
(
core_config
,
calculate
,
exec_prefix
);
if
((
!
calculate
->
prefix_found
||
!
calculate
->
exec_prefix_found
)
&&
!
Py_FrozenFlag
)
!
core_config
->
_frozen
)
{
fprintf
(
stderr
,
"Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
\n
"
);
...
...
Modules/main.c
Dosyayı görüntüle @
b75d7e24
...
...
@@ -573,6 +573,7 @@ _PyCoreConfig_GetGlobalConfig(_PyCoreConfig *config)
COPY_FLAG
(
legacy_windows_fs_encoding
,
Py_LegacyWindowsFSEncodingFlag
);
COPY_FLAG
(
legacy_windows_stdio
,
Py_LegacyWindowsStdioFlag
);
#endif
COPY_FLAG
(
_frozen
,
Py_FrozenFlag
);
COPY_NOT_FLAG
(
use_environment
,
Py_IgnoreEnvironmentFlag
);
COPY_NOT_FLAG
(
site_import
,
Py_NoSiteFlag
);
...
...
@@ -759,6 +760,7 @@ _PyCoreConfig_Copy(_PyCoreConfig *config, const _PyCoreConfig *config2)
COPY_ATTR
(
legacy_windows_stdio
);
#endif
COPY_ATTR
(
_check_hash_pycs_mode
);
COPY_ATTR
(
_frozen
);
#undef COPY_ATTR
#undef COPY_STR_ATTR
...
...
@@ -2281,6 +2283,9 @@ _PyCoreConfig_Read(_PyCoreConfig *config)
if
(
config
->
utf8_mode
<
0
)
{
config
->
utf8_mode
=
0
;
}
if
(
config
->
_frozen
<
0
)
{
config
->
_frozen
=
0
;
}
return
_Py_INIT_OK
();
}
...
...
Programs/_freeze_importlib.c
Dosyayı görüntüle @
b75d7e24
...
...
@@ -82,8 +82,7 @@ main(int argc, char *argv[])
/* Don't install importlib, since it could execute outdated bytecode. */
config
.
_install_importlib
=
0
;
config
.
install_signal_handlers
=
1
;
Py_FrozenFlag
++
;
config
.
_frozen
=
1
;
_PyInitError
err
=
_Py_InitializeFromConfig
(
&
config
);
/* No need to call _PyCoreConfig_Clear() since we didn't allocate any
...
...
Programs/_testembed.c
Dosyayı görüntüle @
b75d7e24
...
...
@@ -368,6 +368,7 @@ dump_config(void)
printf
(
"_install_importlib = %i
\n
"
,
config
->
_install_importlib
);
printf
(
"_check_hash_pycs_mode = %s
\n
"
,
config
->
_check_hash_pycs_mode
);
printf
(
"_frozen = %i
\n
"
,
config
->
_frozen
);
#undef ASSERT_EQUAL
#undef ASSERT_STR_EQUAL
...
...
@@ -420,6 +421,8 @@ static int test_init_global_config(void)
putenv
(
"PYTHONUNBUFFERED="
);
Py_UnbufferedStdioFlag
=
1
;
Py_FrozenFlag
=
1
;
/* FIXME: test Py_LegacyWindowsFSEncodingFlag */
/* FIXME: test Py_LegacyWindowsStdioFlag */
...
...
@@ -525,6 +528,9 @@ static int test_init_from_config(void)
config
.
_check_hash_pycs_mode
=
"always"
;
Py_FrozenFlag
=
0
;
config
.
_frozen
=
1
;
_PyInitError
err
=
_Py_InitializeFromConfig
(
&
config
);
/* Don't call _PyCoreConfig_Clear() since all strings are static */
if
(
_Py_INIT_FAILED
(
err
))
{
...
...
Python/frozenmain.c
Dosyayı görüntüle @
b75d7e24
...
...
@@ -41,7 +41,8 @@ Py_FrozenMain(int argc, char **argv)
}
}
Py_FrozenFlag
=
1
;
/* Suppress errors from getpath.c */
_PyCoreConfig
config
=
_PyCoreConfig_INIT
;
config
.
_frozen
=
1
;
/* Suppress errors from getpath.c */
if
((
p
=
Py_GETENV
(
"PYTHONINSPECT"
))
&&
*
p
!=
'\0'
)
inspect
=
1
;
...
...
@@ -80,7 +81,14 @@ Py_FrozenMain(int argc, char **argv)
#endif
/* MS_WINDOWS */
if
(
argc
>=
1
)
Py_SetProgramName
(
argv_copy
[
0
]);
Py_Initialize
();
err
=
_Py_InitializeFromConfig
(
&
config
);
/* No need to call _PyCoreConfig_Clear() since we didn't allocate any
memory: program_name is a constant string. */
if
(
_Py_INIT_FAILED
(
err
))
{
_Py_FatalInitError
(
err
);
}
#ifdef MS_WINDOWS
PyWinFreeze_ExeInit
();
#endif
...
...
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