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
8c9cd5a3
Kaydet (Commit)
8c9cd5a3
authored
Eki 11, 2013
tarafından
Christian Heimes
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #19205: Don't import the 're' module in site and sysconfig module to
to speed up interpreter start.
üst
fd4722ca
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
4 deletions
+24
-4
site.py
Lib/site.py
+3
-3
sysconfig.py
Lib/sysconfig.py
+3
-1
test_site.py
Lib/test/test_site.py
+15
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/site.py
Dosyayı görüntüle @
8c9cd5a3
...
...
@@ -70,7 +70,6 @@ ImportError exception, it is silently ignored.
import
sys
import
os
import
re
import
builtins
import
_sitebuiltins
...
...
@@ -436,8 +435,7 @@ def aliasmbcs():
encodings
.
_cache
[
enc
]
=
encodings
.
_unknown
encodings
.
aliases
.
aliases
[
enc
]
=
'mbcs'
CONFIG_LINE
=
re
.
compile
(
r'^(?P<key>(\w|[-_])+)\s*=\s*(?P<value>.*)\s*$'
)
CONFIG_LINE
=
r'^(?P<key>(\w|[-_])+)\s*=\s*(?P<value>.*)\s*$'
def
venv
(
known_paths
):
global
PREFIXES
,
ENABLE_USER_SITE
...
...
@@ -460,6 +458,8 @@ def venv(known_paths):
]
if
candidate_confs
:
import
re
config_line
=
re
.
compile
(
CONFIG_LINE
)
virtual_conf
=
candidate_confs
[
0
]
system_site
=
"true"
with
open
(
virtual_conf
)
as
f
:
...
...
Lib/sysconfig.py
Dosyayı görüntüle @
8c9cd5a3
"""Access to Python's configuration information."""
import
os
import
re
import
sys
from
os.path
import
pardir
,
realpath
...
...
@@ -222,6 +221,7 @@ def _parse_makefile(filename, vars=None):
"""
# Regexes needed for parsing Makefile (and similar syntaxes,
# like old-style Setup files).
import
re
_variable_rx
=
re
.
compile
(
"([a-zA-Z][a-zA-Z0-9_]+)
\
s*=
\
s*(.*)"
)
_findvar1_rx
=
re
.
compile
(
r"\$\(([A-Za-z][A-Za-z0-9_]*)\)"
)
_findvar2_rx
=
re
.
compile
(
r"\${([A-Za-z][A-Za-z0-9_]*)}"
)
...
...
@@ -435,6 +435,7 @@ def parse_config_h(fp, vars=None):
"""
if
vars
is
None
:
vars
=
{}
import
re
define_rx
=
re
.
compile
(
"#define ([A-Z][A-Za-z0-9_]+) (.*)
\n
"
)
undef_rx
=
re
.
compile
(
"/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/
\n
"
)
...
...
@@ -658,6 +659,7 @@ def get_platform():
return
"
%
s-
%
s.
%
s"
%
(
osname
,
version
,
release
)
elif
osname
[:
6
]
==
"cygwin"
:
osname
=
"cygwin"
import
re
rel_re
=
re
.
compile
(
r'[\d.]+'
)
m
=
rel_re
.
match
(
release
)
if
m
:
...
...
Lib/test/test_site.py
Dosyayı görüntüle @
8c9cd5a3
...
...
@@ -420,5 +420,20 @@ class ImportSideEffectTests(unittest.TestCase):
self
.
assertEqual
(
code
,
200
,
msg
=
"Can't find "
+
url
)
class
StartupImportTests
(
unittest
.
TestCase
):
def
test_startup_imports
(
self
):
# This tests checks which modules are loaded by Python when it
# initially starts upon startup.
args
=
[
sys
.
executable
,
'-I'
,
'-c'
,
'import sys; print(set(sys.modules))'
]
stdout
=
subprocess
.
check_output
(
args
)
modules
=
eval
(
stdout
.
decode
(
'utf-8'
))
self
.
assertIn
(
'site'
,
modules
)
re_mods
=
{
're'
,
'_sre'
,
'sre_compile'
,
'sre_constants'
,
'sre_parse'
}
self
.
assertFalse
(
modules
.
intersection
(
re_mods
))
if
__name__
==
"__main__"
:
unittest
.
main
()
Misc/NEWS
Dosyayı görüntüle @
8c9cd5a3
...
...
@@ -36,6 +36,9 @@ Core and Builtins
Library
-------
- Issue #19205: Don'
t
import
the
're'
module
in
site
and
sysconfig
module
to
to
speed
up
interpreter
start
.
-
Issue
#
9548
:
Add
a
minimal
"_bootlocale"
module
that
is
imported
by
the
_io
module
instead
of
the
full
locale
module
.
...
...
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