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
b9100e5d
Kaydet (Commit)
b9100e5d
authored
Mar 31, 2015
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #18473: Fixed pickle compatibility tests for optional modules.
Added WindowsError to compatibility mappings.
üst
bfe1824d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
10 deletions
+32
-10
_compat_pickle.py
Lib/_compat_pickle.py
+7
-0
test_pickle.py
Lib/test/test_pickle.py
+25
-10
No files found.
Lib/_compat_pickle.py
Dosyayı görüntüle @
b9100e5d
...
...
@@ -141,6 +141,13 @@ PYTHON2_EXCEPTIONS = (
"ZeroDivisionError"
,
)
try
:
WindowsError
except
NameError
:
pass
else
:
PYTHON2_EXCEPTIONS
+=
(
"WindowsError"
,)
for
excname
in
PYTHON2_EXCEPTIONS
:
NAME_MAPPING
[(
"exceptions"
,
excname
)]
=
(
"builtins"
,
excname
)
...
...
Lib/test/test_pickle.py
Dosyayı görüntüle @
b9100e5d
...
...
@@ -240,7 +240,16 @@ def getmodule(module):
try
:
return
sys
.
modules
[
module
]
except
KeyError
:
__import__
(
module
)
try
:
__import__
(
module
)
except
AttributeError
as
exc
:
if
support
.
verbose
:
print
(
"Can't import module
%
r:
%
s"
%
(
module
,
exc
))
raise
ImportError
except
ImportError
as
exc
:
if
support
.
verbose
:
print
(
exc
)
raise
return
sys
.
modules
[
module
]
def
getattribute
(
module
,
name
):
...
...
@@ -264,18 +273,16 @@ class CompatPickleTests(unittest.TestCase):
for
module
in
modules
:
try
:
getmodule
(
module
)
except
ImportError
as
exc
:
if
support
.
verbose
:
print
(
exc
)
except
ImportError
:
pass
def
test_import_mapping
(
self
):
for
module3
,
module2
in
REVERSE_IMPORT_MAPPING
.
items
():
with
self
.
subTest
((
module3
,
module2
)):
try
:
getmodule
(
module3
)
except
ImportError
as
exc
:
if
support
.
verbose
:
print
(
exc
)
except
ImportError
:
pass
if
module3
[:
1
]
!=
'_'
:
self
.
assertIn
(
module2
,
IMPORT_MAPPING
)
self
.
assertEqual
(
IMPORT_MAPPING
[
module2
],
module3
)
...
...
@@ -283,14 +290,19 @@ class CompatPickleTests(unittest.TestCase):
def
test_name_mapping
(
self
):
for
(
module3
,
name3
),
(
module2
,
name2
)
in
REVERSE_NAME_MAPPING
.
items
():
with
self
.
subTest
(((
module3
,
name3
),
(
module2
,
name2
))):
attr
=
getattribute
(
module3
,
name3
)
if
(
module2
,
name2
)
==
(
'exceptions'
,
'OSError'
):
attr
=
getattribute
(
module3
,
name3
)
self
.
assertTrue
(
issubclass
(
attr
,
OSError
))
else
:
module
,
name
=
mapping
(
module2
,
name2
)
if
module3
[:
1
]
!=
'_'
:
self
.
assertEqual
((
module
,
name
),
(
module3
,
name3
))
self
.
assertEqual
(
getattribute
(
module
,
name
),
attr
)
try
:
attr
=
getattribute
(
module3
,
name3
)
except
ImportError
:
pass
else
:
self
.
assertEqual
(
getattribute
(
module
,
name
),
attr
)
def
test_reverse_import_mapping
(
self
):
for
module2
,
module3
in
IMPORT_MAPPING
.
items
():
...
...
@@ -315,7 +327,10 @@ class CompatPickleTests(unittest.TestCase):
def
test_reverse_name_mapping
(
self
):
for
(
module2
,
name2
),
(
module3
,
name3
)
in
NAME_MAPPING
.
items
():
with
self
.
subTest
(((
module2
,
name2
),
(
module3
,
name3
))):
attr
=
getattribute
(
module3
,
name3
)
try
:
attr
=
getattribute
(
module3
,
name3
)
except
ImportError
:
pass
module
,
name
=
reverse_mapping
(
module3
,
name3
)
if
(
module2
,
name2
,
module3
,
name3
)
not
in
ALT_NAME_MAPPING
:
self
.
assertEqual
((
module
,
name
),
(
module2
,
name2
))
...
...
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