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
8eb1f077
Kaydet (Commit)
8eb1f077
authored
May 16, 2015
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #18682: Optimized pprint functions for builtin scalar types.
üst
6d90fd5f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
18 deletions
+6
-18
pprint.py
Lib/pprint.py
+4
-18
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/pprint.py
Dosyayı görüntüle @
8eb1f077
...
@@ -489,24 +489,8 @@ class PrettyPrinter:
...
@@ -489,24 +489,8 @@ class PrettyPrinter:
def
_safe_repr
(
object
,
context
,
maxlevels
,
level
):
def
_safe_repr
(
object
,
context
,
maxlevels
,
level
):
typ
=
type
(
object
)
typ
=
type
(
object
)
if
typ
is
str
:
if
typ
in
_builtin_scalars
:
if
'locale'
not
in
_sys
.
modules
:
return
repr
(
object
),
True
,
False
return
repr
(
object
),
True
,
False
if
"'"
in
object
and
'"'
not
in
object
:
closure
=
'"'
quotes
=
{
'"'
:
'
\\
"'
}
else
:
closure
=
"'"
quotes
=
{
"'"
:
"
\\
'"
}
qget
=
quotes
.
get
sio
=
_StringIO
()
write
=
sio
.
write
for
char
in
object
:
if
char
.
isalpha
():
write
(
char
)
else
:
write
(
qget
(
char
,
repr
(
char
)[
1
:
-
1
]))
return
(
"
%
s
%
s
%
s"
%
(
closure
,
sio
.
getvalue
(),
closure
)),
True
,
False
r
=
getattr
(
typ
,
"__repr__"
,
None
)
r
=
getattr
(
typ
,
"__repr__"
,
None
)
if
issubclass
(
typ
,
dict
)
and
r
is
dict
.
__repr__
:
if
issubclass
(
typ
,
dict
)
and
r
is
dict
.
__repr__
:
...
@@ -571,6 +555,8 @@ def _safe_repr(object, context, maxlevels, level):
...
@@ -571,6 +555,8 @@ def _safe_repr(object, context, maxlevels, level):
rep
=
repr
(
object
)
rep
=
repr
(
object
)
return
rep
,
(
rep
and
not
rep
.
startswith
(
'<'
)),
False
return
rep
,
(
rep
and
not
rep
.
startswith
(
'<'
)),
False
_builtin_scalars
=
frozenset
({
str
,
bytes
,
bytearray
,
int
,
float
,
complex
,
bool
,
type
(
None
)})
def
_recursion
(
object
):
def
_recursion
(
object
):
return
(
"<Recursion on
%
s with id=
%
s>"
return
(
"<Recursion on
%
s with id=
%
s>"
...
...
Misc/NEWS
Dosyayı görüntüle @
8eb1f077
...
@@ -47,6 +47,8 @@ Core and Builtins
...
@@ -47,6 +47,8 @@ Core and Builtins
Library
Library
-------
-------
- Issue #18682: Optimized pprint functions for builtin scalar types.
- Issue #22027: smtplib now supports RFC 6531 (SMTPUTF8).
- Issue #22027: smtplib now supports RFC 6531 (SMTPUTF8).
- Issue #23488: Random generator objects now consume 2x less memory on 64-bit.
- Issue #23488: Random generator objects now consume 2x less memory on 64-bit.
...
...
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