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
6a01fc5d
Kaydet (Commit)
6a01fc5d
authored
Tem 21, 2012
tarafından
Florent Xicluna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issues #10017 and #14998: Fix TypeError using pprint on dictionaries with unorderable key.
üst
5116704e
d6da90f9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
2 deletions
+18
-2
pprint.py
Lib/pprint.py
+5
-1
test_pprint.py
Lib/test/test_pprint.py
+9
-0
NEWS
Misc/NEWS
+4
-1
No files found.
Lib/pprint.py
Dosyayı görüntüle @
6a01fc5d
...
@@ -86,7 +86,11 @@ class _safe_key:
...
@@ -86,7 +86,11 @@ class _safe_key:
self
.
obj
=
obj
self
.
obj
=
obj
def
__lt__
(
self
,
other
):
def
__lt__
(
self
,
other
):
rv
=
self
.
obj
.
__lt__
(
other
.
obj
)
try
:
rv
=
self
.
obj
.
__lt__
(
other
.
obj
)
except
TypeError
:
rv
=
NotImplemented
if
rv
is
NotImplemented
:
if
rv
is
NotImplemented
:
rv
=
(
str
(
type
(
self
.
obj
)),
id
(
self
.
obj
))
<
\
rv
=
(
str
(
type
(
self
.
obj
)),
id
(
self
.
obj
))
<
\
(
str
(
type
(
other
.
obj
)),
id
(
other
.
obj
))
(
str
(
type
(
other
.
obj
)),
id
(
other
.
obj
))
...
...
Lib/test/test_pprint.py
Dosyayı görüntüle @
6a01fc5d
...
@@ -466,6 +466,15 @@ class QueryTestCase(unittest.TestCase):
...
@@ -466,6 +466,15 @@ class QueryTestCase(unittest.TestCase):
self
.
assertEqual
(
clean
(
pprint
.
pformat
(
dict
.
fromkeys
(
keys
))),
self
.
assertEqual
(
clean
(
pprint
.
pformat
(
dict
.
fromkeys
(
keys
))),
'{'
+
','
.
join
(
'
%
r:None'
%
k
for
k
in
skeys
)
+
'}'
)
'{'
+
','
.
join
(
'
%
r:None'
%
k
for
k
in
skeys
)
+
'}'
)
# Issue 10017: TypeError on user-defined types as dict keys.
self
.
assertEqual
(
pprint
.
pformat
({
Unorderable
:
0
,
1
:
0
}),
'{1: 0, '
+
repr
(
Unorderable
)
+
': 0}'
)
# Issue 14998: TypeError on tuples with NoneTypes as dict keys.
self
.
assertEqual
(
pprint
.
pformat
({(
1
,):
0
,
(
None
,):
0
}),
'{(1,): 0, (None,): 0}'
)
class
DottedPrettyPrinter
(
pprint
.
PrettyPrinter
):
class
DottedPrettyPrinter
(
pprint
.
PrettyPrinter
):
def
format
(
self
,
object
,
context
,
maxlevels
,
level
):
def
format
(
self
,
object
,
context
,
maxlevels
,
level
):
...
...
Misc/NEWS
Dosyayı görüntüle @
6a01fc5d
...
@@ -48,10 +48,13 @@ Core and Builtins
...
@@ -48,10 +48,13 @@ Core and Builtins
-
Issue
15307
:
Virtual
environments
now
use
symlinks
with
framework
builds
-
Issue
15307
:
Virtual
environments
now
use
symlinks
with
framework
builds
on
Mac
OS
X
,
like
other
POSIX
builds
.
on
Mac
OS
X
,
like
other
POSIX
builds
.
Library
Library
-------
-------
-
Issues
#
10017
and
#
14998
:
Fix
TypeError
using
pprint
on
dictionaries
with
user
-
defined
types
as
keys
or
other
unorderable
keys
.
-
Issue
#
15397
:
inspect
.
getmodulename
()
is
now
based
directly
on
importlib
-
Issue
#
15397
:
inspect
.
getmodulename
()
is
now
based
directly
on
importlib
via
a
new
importlib
.
machinery
.
all_suffixes
()
API
.
via
a
new
importlib
.
machinery
.
all_suffixes
()
API
.
...
...
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