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
5f9193a6
Kaydet (Commit)
5f9193a6
authored
Şub 04, 2017
tarafından
Steve Dower
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #29326: Ignores blank lines in ._pth files (Patch by Alexey Izbyshev)
üst
722e3e27
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
14 deletions
+31
-14
test_site.py
Lib/test/test_site.py
+27
-13
ACKS
Misc/ACKS
+1
-0
NEWS
Misc/NEWS
+2
-0
getpathp.c
PC/getpathp.c
+1
-1
No files found.
Lib/test/test_site.py
Dosyayı görüntüle @
5f9193a6
...
...
@@ -511,16 +511,30 @@ class StartupImportTests(unittest.TestCase):
os
.
unlink
(
_pth_file
)
os
.
unlink
(
exe_file
)
@classmethod
def
_calc_sys_path_for_underpth_nosite
(
self
,
sys_prefix
,
lines
):
sys_path
=
[]
for
line
in
lines
:
if
not
line
or
line
[
0
]
==
'#'
:
continue
abs_path
=
os
.
path
.
abspath
(
os
.
path
.
join
(
sys_prefix
,
line
))
sys_path
.
append
(
abs_path
)
return
sys_path
@unittest.skipUnless
(
sys
.
platform
==
'win32'
,
"only supported on Windows"
)
def
test_underpth_nosite_file
(
self
):
libpath
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
encodings
.
__file__
))
exe_prefix
=
os
.
path
.
dirname
(
sys
.
executable
)
exe_file
=
self
.
_create_underpth_exe
(
[
pth_lines
=
[
'fake-path-name'
,
*
[
libpath
for
_
in
range
(
200
)],
''
,
'# comment'
,
'import site'
])
]
exe_file
=
self
.
_create_underpth_exe
(
pth_lines
)
sys_path
=
self
.
_calc_sys_path_for_underpth_nosite
(
os
.
path
.
dirname
(
exe_file
),
pth_lines
)
try
:
env
=
os
.
environ
.
copy
()
...
...
@@ -529,14 +543,11 @@ class StartupImportTests(unittest.TestCase):
rc
=
subprocess
.
call
([
exe_file
,
'-c'
,
'import sys; sys.exit(sys.flags.no_site and '
'len(sys.path) > 200 and '
'
%
r in sys.path and
%
r in sys.path and
%
r not in sys.path)'
%
(
os
.
path
.
join
(
sys
.
prefix
,
'fake-path-name'
),
libpath
,
os
.
path
.
join
(
sys
.
prefix
,
'from-env'
),
)],
env
=
env
)
'sys.path ==
%
r)'
%
sys_path
,
],
env
=
env
)
finally
:
self
.
_cleanup_underpth_exe
(
exe_file
)
self
.
assert
Equal
(
rc
,
0
)
self
.
assert
True
(
rc
,
"sys.path is incorrect"
)
@unittest.skipUnless
(
sys
.
platform
==
'win32'
,
"only supported on Windows"
)
def
test_underpth_file
(
self
):
...
...
@@ -545,23 +556,26 @@ class StartupImportTests(unittest.TestCase):
exe_file
=
self
.
_create_underpth_exe
([
'fake-path-name'
,
*
[
libpath
for
_
in
range
(
200
)],
''
,
'# comment'
,
'import site'
])
sys_prefix
=
os
.
path
.
dirname
(
exe_file
)
try
:
env
=
os
.
environ
.
copy
()
env
[
'PYTHONPATH'
]
=
'from-env'
env
[
'PATH'
]
=
'{};{}'
.
format
(
exe_prefix
,
os
.
getenv
(
'PATH'
))
rc
=
subprocess
.
call
([
exe_file
,
'-c'
,
'import sys; sys.exit(not sys.flags.no_site and '
'
%
r in sys.path and
%
r in sys.path and
%
r not in sys.path)'
%
(
os
.
path
.
join
(
sys
.
prefix
,
'fake-path-name'
),
'
%
r in sys.path and
%
r in sys.path and
%
r not in sys.path and '
'all("
\\
r" not in p and "
\\
n" not in p for p in sys.path))'
%
(
os
.
path
.
join
(
sys_prefix
,
'fake-path-name'
),
libpath
,
os
.
path
.
join
(
sys
.
prefix
,
'from-env'
),
os
.
path
.
join
(
sys
_
prefix
,
'from-env'
),
)],
env
=
env
)
finally
:
self
.
_cleanup_underpth_exe
(
exe_file
)
self
.
assert
Equal
(
rc
,
0
)
self
.
assert
True
(
rc
,
"sys.path is incorrect"
)
if
__name__
==
"__main__"
:
...
...
Misc/ACKS
Dosyayı görüntüle @
5f9193a6
...
...
@@ -683,6 +683,7 @@ John Interrante
Bob Ippolito
Roger Irwin
Atsuo Ishimoto
Alexey Izbyshev
Kasia Jachim
Adam Jackson
Ben Jackson
...
...
Misc/NEWS
Dosyayı görüntüle @
5f9193a6
...
...
@@ -146,6 +146,8 @@ Library
Windows
-------
- Issue #29326: Ignores blank lines in ._pth files (Patch by Alexey Izbyshev)
- Issue #28164: Correctly handle special console filenames (patch by Eryk Sun)
- Issue #29409: Implement PEP 529 for io.FileIO (Patch by Eryk Sun)
...
...
PC/getpathp.c
Dosyayı görüntüle @
5f9193a6
...
...
@@ -560,7 +560,7 @@ read_pth_file(const wchar_t *path, wchar_t *prefix, int *isolated, int *nosite)
char
*
p
=
fgets
(
line
,
MAXPATHLEN
+
1
,
sp_file
);
if
(
!
p
)
break
;
if
(
*
p
==
'\0'
||
*
p
==
'#'
)
if
(
*
p
==
'\0'
||
*
p
==
'
\r'
||
*
p
==
'\n'
||
*
p
==
'
#'
)
continue
;
while
(
*++
p
)
{
if
(
*
p
==
'\r'
||
*
p
==
'\n'
)
{
...
...
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