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
7c9cf012
Kaydet (Commit)
7c9cf012
authored
Eyl 08, 2010
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
gdb: fix representation of non-printable surrogate pairs, and workaround
a bug in ascii().
üst
b1856d7f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
9 deletions
+14
-9
test_gdb.py
Lib/test/test_gdb.py
+3
-1
libpython.py
Tools/gdb/libpython.py
+11
-8
No files found.
Lib/test/test_gdb.py
Dosyayı görüntüle @
7c9cf012
...
...
@@ -234,7 +234,9 @@ class PrettyPrintTests(DebuggerTests):
text
.
encode
(
encoding
)
printable
=
True
except
UnicodeEncodeError
:
self
.
assertGdbRepr
(
text
,
ascii
(
text
))
# Workaround ascii() bug on UCS-2 builds: issue #9804
asc
=
"'"
+
text
.
encode
(
'unicode-escape'
)
.
decode
(
'ascii'
)
+
"'"
self
.
assertGdbRepr
(
text
,
asc
)
else
:
self
.
assertGdbRepr
(
text
)
...
...
Tools/gdb/libpython.py
Dosyayı görüntüle @
7c9cf012
...
...
@@ -1171,9 +1171,8 @@ class PyUnicodeObjectPtr(PyObjectPtr):
# Non-ASCII characters
else
:
ucs
=
ch
orig_ucs
=
None
ch2
=
None
if
s
elf
.
char_width
()
==
2
:
if
s
ys
.
maxunicode
<
0x10000
:
# If sizeof(Py_UNICODE) is 2 here (in gdb), join
# surrogate pairs before calling _unichr_is_printable.
if
(
i
<
len
(
proxy
)
...
...
@@ -1183,22 +1182,26 @@ class PyUnicodeObjectPtr(PyObjectPtr):
ucs
=
ch
+
ch2
i
+=
1
# Unfortuately, Python 2's unicode type doesn't seem
# to expose the "isprintable" method
printable
=
_unichr_is_printable
(
ucs
)
if
printable
:
try
:
ucs
.
encode
(
ENCODING
)
except
UnicodeEncodeError
:
printable
=
False
if
orig_ucs
is
not
None
:
ucs
=
orig_ucs
i
-=
1
# Map Unicode whitespace and control characters
# (categories Z* and C* except ASCII space)
if
not
printable
:
# Unfortuately, Python 2's unicode type doesn't seem
# to expose the "isprintable" method
code
=
ord
(
ucs
)
if
ch2
is
not
None
:
# Match Python 3's representation of non-printable
# wide characters.
code
=
(
ord
(
ch
)
&
0x03FF
)
<<
10
code
|=
ord
(
ch2
)
&
0x03FF
code
+=
0x00010000
else
:
code
=
ord
(
ucs
)
# Map 8-bit characters to '\\xhh'
if
code
<=
0xff
:
...
...
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