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
b103a937
Kaydet (Commit)
b103a937
authored
Eki 12, 2010
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #6612: Fix site and sysconfig to catch os.getcwd() error, eg. if the
current directory was deleted.
üst
6c314ec9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
11 deletions
+29
-11
site.py
Lib/site.py
+7
-3
sysconfig.py
Lib/sysconfig.py
+19
-8
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/site.py
Dosyayı görüntüle @
b103a937
...
...
@@ -70,7 +70,11 @@ USER_BASE = None
def
makepath
(
*
paths
):
dir
=
os
.
path
.
abspath
(
os
.
path
.
join
(
*
paths
))
dir
=
os
.
path
.
join
(
*
paths
)
try
:
dir
=
os
.
path
.
abspath
(
dir
)
except
OSError
:
pass
return
dir
,
os
.
path
.
normcase
(
dir
)
...
...
@@ -81,11 +85,11 @@ def abs_paths():
continue
# don't mess with a PEP 302-supplied __file__
try
:
m
.
__file__
=
os
.
path
.
abspath
(
m
.
__file__
)
except
AttributeError
:
except
(
AttributeError
,
OSError
)
:
pass
try
:
m
.
__cached__
=
os
.
path
.
abspath
(
m
.
__cached__
)
except
AttributeError
:
except
(
AttributeError
,
OSError
)
:
pass
...
...
Lib/sysconfig.py
Dosyayı görüntüle @
b103a937
...
...
@@ -107,21 +107,28 @@ _PREFIX = os.path.normpath(sys.prefix)
_EXEC_PREFIX
=
os
.
path
.
normpath
(
sys
.
exec_prefix
)
_CONFIG_VARS
=
None
_USER_BASE
=
None
def
_safe_realpath
(
path
):
try
:
return
realpath
(
path
)
except
OSError
:
return
path
if
sys
.
executable
:
_PROJECT_BASE
=
os
.
path
.
dirname
(
realpath
(
sys
.
executable
))
_PROJECT_BASE
=
os
.
path
.
dirname
(
_safe_
realpath
(
sys
.
executable
))
else
:
# sys.executable can be empty if argv[0] has been changed and Python is
# unable to retrieve the real program name
_PROJECT_BASE
=
realpath
(
os
.
getcwd
())
_PROJECT_BASE
=
_safe_
realpath
(
os
.
getcwd
())
if
os
.
name
==
"nt"
and
"pcbuild"
in
_PROJECT_BASE
[
-
8
:]
.
lower
():
_PROJECT_BASE
=
realpath
(
os
.
path
.
join
(
_PROJECT_BASE
,
pardir
))
_PROJECT_BASE
=
_safe_
realpath
(
os
.
path
.
join
(
_PROJECT_BASE
,
pardir
))
# PC/VS7.1
if
os
.
name
==
"nt"
and
"
\\
pc
\\
v"
in
_PROJECT_BASE
[
-
10
:]
.
lower
():
_PROJECT_BASE
=
realpath
(
os
.
path
.
join
(
_PROJECT_BASE
,
pardir
,
pardir
))
_PROJECT_BASE
=
_safe_
realpath
(
os
.
path
.
join
(
_PROJECT_BASE
,
pardir
,
pardir
))
# PC/AMD64
if
os
.
name
==
"nt"
and
"
\\
pcbuild
\\
amd64"
in
_PROJECT_BASE
[
-
14
:]
.
lower
():
_PROJECT_BASE
=
realpath
(
os
.
path
.
join
(
_PROJECT_BASE
,
pardir
,
pardir
))
_PROJECT_BASE
=
_safe_
realpath
(
os
.
path
.
join
(
_PROJECT_BASE
,
pardir
,
pardir
))
def
is_python_build
():
for
fn
in
(
"Setup.dist"
,
"Setup.local"
):
...
...
@@ -362,7 +369,7 @@ def _init_non_posix(vars):
vars
[
'SO'
]
=
'.pyd'
vars
[
'EXE'
]
=
'.exe'
vars
[
'VERSION'
]
=
_PY_VERSION_SHORT_NO_DOT
vars
[
'BINDIR'
]
=
os
.
path
.
dirname
(
realpath
(
sys
.
executable
))
vars
[
'BINDIR'
]
=
os
.
path
.
dirname
(
_safe_
realpath
(
sys
.
executable
))
#
# public APIs
...
...
@@ -475,7 +482,7 @@ def get_config_vars(*args):
if
'srcdir'
not
in
_CONFIG_VARS
:
_CONFIG_VARS
[
'srcdir'
]
=
_PROJECT_BASE
else
:
_CONFIG_VARS
[
'srcdir'
]
=
realpath
(
_CONFIG_VARS
[
'srcdir'
])
_CONFIG_VARS
[
'srcdir'
]
=
_safe_
realpath
(
_CONFIG_VARS
[
'srcdir'
])
# Convert srcdir into an absolute path if it appears necessary.
...
...
@@ -484,8 +491,12 @@ def get_config_vars(*args):
# from a different directory.
if
_PYTHON_BUILD
and
os
.
name
==
"posix"
:
base
=
_PROJECT_BASE
try
:
cwd
=
os
.
getcwd
()
except
OSError
:
cwd
=
None
if
(
not
os
.
path
.
isabs
(
_CONFIG_VARS
[
'srcdir'
])
and
base
!=
os
.
getcwd
()
):
base
!=
cwd
):
# srcdir is relative and we are not in the same directory
# as the executable. Assume executable is in the build
# directory and make srcdir absolute.
...
...
Misc/NEWS
Dosyayı görüntüle @
b103a937
...
...
@@ -10,6 +10,9 @@ What's New in Python 3.2 Beta 1?
Core and Builtins
-----------------
- Issue #6612: Fix site and sysconfig to catch os.getcwd() error, eg. if the
current directory was deleted.
Library
-------
...
...
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