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
c9e1dcdd
Kaydet (Commit)
c9e1dcdd
authored
Eyl 04, 2013
tarafından
Meador Inge
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #16826: Revert fix while Windows issues are being worked out.
üst
d151da9e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
92 deletions
+19
-92
_bootstrap.py
Lib/importlib/_bootstrap.py
+1
-4
test_case_sensitivity.py
Lib/test/test_importlib/extension/test_case_sensitivity.py
+8
-29
test_case_sensitivity.py
Lib/test/test_importlib/source/test_case_sensitivity.py
+10
-57
NEWS
Misc/NEWS
+0
-2
importlib.h
Python/importlib.h
+0
-0
No files found.
Lib/importlib/_bootstrap.py
Dosyayı görüntüle @
c9e1dcdd
...
@@ -33,10 +33,7 @@ def _make_relax_case():
...
@@ -33,10 +33,7 @@ def _make_relax_case():
if
sys
.
platform
.
startswith
(
_CASE_INSENSITIVE_PLATFORMS
):
if
sys
.
platform
.
startswith
(
_CASE_INSENSITIVE_PLATFORMS
):
def
_relax_case
():
def
_relax_case
():
"""True if filenames must be checked case-insensitively."""
"""True if filenames must be checked case-insensitively."""
if
sys
.
flags
.
ignore_environment
:
return
b
'PYTHONCASEOK'
in
_os
.
environ
return
False
else
:
return
b
'PYTHONCASEOK'
in
_os
.
environ
else
:
else
:
def
_relax_case
():
def
_relax_case
():
"""True if filenames must be checked case-insensitively."""
"""True if filenames must be checked case-insensitively."""
...
...
Lib/test/test_importlib/extension/test_case_sensitivity.py
Dosyayı görüntüle @
c9e1dcdd
...
@@ -5,8 +5,7 @@ import unittest
...
@@ -5,8 +5,7 @@ import unittest
from
importlib
import
_bootstrap
from
importlib
import
_bootstrap
from
..
import
util
from
..
import
util
from
.
import
util
as
ext_util
from
.
import
util
as
ext_util
import
os
import
subprocess
@util.case_insensitive_tests
@util.case_insensitive_tests
class
ExtensionModuleCaseSensitivityTest
(
unittest
.
TestCase
):
class
ExtensionModuleCaseSensitivityTest
(
unittest
.
TestCase
):
...
@@ -30,34 +29,14 @@ class ExtensionModuleCaseSensitivityTest(unittest.TestCase):
...
@@ -30,34 +29,14 @@ class ExtensionModuleCaseSensitivityTest(unittest.TestCase):
self
.
assertIsNone
(
loader
)
self
.
assertIsNone
(
loader
)
def
test_case_insensitivity
(
self
):
def
test_case_insensitivity
(
self
):
find_snippet
=
"""if True:
with
support
.
EnvironmentVarGuard
()
as
env
:
from importlib import _bootstrap
env
.
set
(
'PYTHONCASEOK'
,
'1'
)
import sys
if
b
'PYTHONCASEOK'
not
in
_bootstrap
.
_os
.
environ
:
finder = _bootstrap.FileFinder('{path}',
self
.
skipTest
(
'os.environ changes not reflected in '
(_bootstrap.ExtensionFileLoader,
'_os.environ'
)
_bootstrap.EXTENSION_SUFFIXES))
loader
=
self
.
find_module
()
loader = finder.find_module('{bad_name}')
self
.
assertTrue
(
hasattr
(
loader
,
'load_module'
))
print(str(hasattr(loader, 'load_module')))
"""
.
format
(
bad_name
=
ext_util
.
NAME
.
upper
(),
path
=
ext_util
.
PATH
)
newenv
=
os
.
environ
.
copy
()
newenv
[
"PYTHONCASEOK"
]
=
"1"
def
check_output
(
expected
,
extra_arg
=
None
):
args
=
[
sys
.
executable
]
if
extra_arg
:
args
.
append
(
extra_arg
)
args
.
extend
([
"-c"
,
find_snippet
])
p
=
subprocess
.
Popen
(
args
,
stdout
=
subprocess
.
PIPE
,
env
=
newenv
)
actual
=
p
.
communicate
()[
0
]
.
decode
()
.
strip
()
self
.
assertEqual
(
expected
,
actual
)
self
.
assertEqual
(
p
.
wait
(),
0
)
# Test with PYTHONCASEOK=1.
check_output
(
"True"
)
# Test with PYTHONCASEOK=1 ignored because of -E.
check_output
(
"False"
,
"-E"
)
...
...
Lib/test/test_importlib/source/test_case_sensitivity.py
Dosyayı görüntüle @
c9e1dcdd
...
@@ -8,7 +8,6 @@ import os
...
@@ -8,7 +8,6 @@ import os
import
sys
import
sys
from
test
import
support
as
test_support
from
test
import
support
as
test_support
import
unittest
import
unittest
import
subprocess
@util.case_insensitive_tests
@util.case_insensitive_tests
...
@@ -51,62 +50,16 @@ class CaseSensitivityTest(unittest.TestCase):
...
@@ -51,62 +50,16 @@ class CaseSensitivityTest(unittest.TestCase):
self
.
assertIsNone
(
insensitive
)
self
.
assertIsNone
(
insensitive
)
def
test_insensitive
(
self
):
def
test_insensitive
(
self
):
sensitive_pkg
=
'sensitive.{0}'
.
format
(
self
.
name
)
with
test_support
.
EnvironmentVarGuard
()
as
env
:
insensitive_pkg
=
'insensitive.{0}'
.
format
(
self
.
name
.
lower
())
env
.
set
(
'PYTHONCASEOK'
,
'1'
)
context
=
source_util
.
create_modules
(
insensitive_pkg
,
sensitive_pkg
)
if
b
'PYTHONCASEOK'
not
in
_bootstrap
.
_os
.
environ
:
with
context
as
mapping
:
self
.
skipTest
(
'os.environ changes not reflected in '
sensitive_path
=
os
.
path
.
join
(
mapping
[
'.root'
],
'sensitive'
)
'_os.environ'
)
insensitive_path
=
os
.
path
.
join
(
mapping
[
'.root'
],
'insensitive'
)
sensitive
,
insensitive
=
self
.
sensitivity_test
()
find_snippet
=
"""if True:
self
.
assertTrue
(
hasattr
(
sensitive
,
'load_module'
))
import sys
self
.
assertIn
(
self
.
name
,
sensitive
.
get_filename
(
self
.
name
))
from importlib import machinery
self
.
assertTrue
(
hasattr
(
insensitive
,
'load_module'
))
self
.
assertIn
(
self
.
name
,
insensitive
.
get_filename
(
self
.
name
))
def find(path):
f = machinery.FileFinder(path,
(machinery.SourceFileLoader,
machinery.SOURCE_SUFFIXES),
(machinery.SourcelessFileLoader,
machinery.BYTECODE_SUFFIXES))
return f.find_module('{name}')
sensitive = find('{sensitive_path}')
insensitive = find('{insensitive_path}')
print(str(hasattr(sensitive, 'load_module')))
if hasattr(sensitive, 'load_module'):
print(sensitive.get_filename('{name}'))
else:
print('None')
print(str(hasattr(insensitive, 'load_module')))
if hasattr(insensitive, 'load_module'):
print(insensitive.get_filename('{name}'))
else:
print('None')
"""
.
format
(
sensitive_path
=
sensitive_path
,
insensitive_path
=
insensitive_path
,
name
=
self
.
name
)
newenv
=
os
.
environ
.
copy
()
newenv
[
"PYTHONCASEOK"
]
=
"1"
def
check_output
(
expected
,
extra_arg
=
None
):
args
=
[
sys
.
executable
]
if
extra_arg
:
args
.
append
(
extra_arg
)
args
.
extend
([
"-c"
,
find_snippet
])
p
=
subprocess
.
Popen
(
args
,
stdout
=
subprocess
.
PIPE
,
env
=
newenv
)
actual
=
p
.
communicate
()[
0
]
.
decode
()
.
split
()
self
.
assertEqual
(
expected
[
0
],
actual
[
0
])
self
.
assertIn
(
expected
[
1
],
actual
[
1
])
self
.
assertEqual
(
expected
[
2
],
actual
[
2
])
self
.
assertIn
(
expected
[
3
],
actual
[
3
])
self
.
assertEqual
(
p
.
wait
(),
0
)
# Test with PYTHONCASEOK=1.
check_output
([
"True"
,
self
.
name
,
"True"
,
self
.
name
])
# Test with PYTHONCASEOK=1 ignored because of -E.
check_output
([
"True"
,
self
.
name
,
"False"
,
"None"
],
"-E"
)
def
test_main
():
def
test_main
():
...
...
Misc/NEWS
Dosyayı görüntüle @
c9e1dcdd
...
@@ -66,8 +66,6 @@ Core and Builtins
...
@@ -66,8 +66,6 @@ Core and Builtins
Library
Library
-------
-------
- Issue #16826: Don'
t
check
for
PYTHONCASEOK
if
interpreter
started
with
-
E
.
- Issue #18418: After fork(), reinit all threads states, not only active ones.
- Issue #18418: After fork(), reinit all threads states, not only active ones.
Patch by A. Jesse Jiryu Davis.
Patch by A. Jesse Jiryu Davis.
...
...
Python/importlib.h
Dosyayı görüntüle @
c9e1dcdd
This diff is collapsed.
Click to expand it.
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