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
c47016ee
Kaydet (Commit)
c47016ee
authored
Agu 16, 2001
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use (c)StringIO for collecting bytes. Fixes bug #451622.
üst
63a8d694
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
xdrlib.py
Lib/xdrlib.py
+12
-8
No files found.
Lib/xdrlib.py
Dosyayı görüntüle @
c47016ee
...
...
@@ -5,6 +5,10 @@ See: RFC 1014
"""
import
struct
try
:
from
cStringIO
import
StringIO
as
_StringIO
except
ImportError
:
from
StringIO
import
StringIO
as
_StringIO
__all__
=
[
"Error"
,
"Packer"
,
"Unpacker"
,
"ConversionError"
]
...
...
@@ -39,22 +43,22 @@ class Packer:
self
.
reset
()
def
reset
(
self
):
self
.
__buf
=
''
self
.
__buf
=
_StringIO
()
def
get_buffer
(
self
):
return
self
.
__buf
return
self
.
__buf
.
getvalue
()
# backwards compatibility
get_buf
=
get_buffer
def
pack_uint
(
self
,
x
):
self
.
__buf
=
self
.
__buf
+
struct
.
pack
(
'>L'
,
x
)
self
.
__buf
.
write
(
struct
.
pack
(
'>L'
,
x
)
)
pack_int
=
pack_uint
pack_enum
=
pack_int
def
pack_bool
(
self
,
x
):
if
x
:
self
.
__buf
=
self
.
__buf
+
'
\0\0\0\1
'
else
:
self
.
__buf
=
self
.
__buf
+
'
\0\0\0\0
'
if
x
:
self
.
__buf
.
write
(
'
\0\0\0\1
'
)
else
:
self
.
__buf
.
write
(
'
\0\0\0\0
'
)
def
pack_uhyper
(
self
,
x
):
self
.
pack_uint
(
x
>>
32
&
0xffffffff
L
)
...
...
@@ -63,12 +67,12 @@ class Packer:
pack_hyper
=
pack_uhyper
def
pack_float
(
self
,
x
):
try
:
self
.
__buf
=
self
.
__buf
+
struct
.
pack
(
'>f'
,
x
)
try
:
self
.
__buf
.
write
(
struct
.
pack
(
'>f'
,
x
)
)
except
struct
.
error
,
msg
:
raise
ConversionError
,
msg
def
pack_double
(
self
,
x
):
try
:
self
.
__buf
=
self
.
__buf
+
struct
.
pack
(
'>d'
,
x
)
try
:
self
.
__buf
.
write
(
struct
.
pack
(
'>d'
,
x
)
)
except
struct
.
error
,
msg
:
raise
ConversionError
,
msg
...
...
@@ -78,7 +82,7 @@ class Packer:
n
=
((
n
+
3
)
/
4
)
*
4
data
=
s
[:
n
]
data
=
data
+
(
n
-
len
(
data
))
*
'
\0
'
self
.
__buf
=
self
.
__buf
+
data
self
.
__buf
.
write
(
data
)
pack_fopaque
=
pack_fstring
...
...
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