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
07529354
Kaydet (Commit)
07529354
authored
Kas 19, 2006
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Patch #1070046: Marshal new-style objects like InstanceType
in xmlrpclib.
üst
9eec51c0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
4 deletions
+33
-4
libxmlrpclib.tex
Doc/lib/libxmlrpclib.tex
+8
-1
test_xmlrpc.py
Lib/test/test_xmlrpc.py
+9
-0
xmlrpclib.py
Lib/xmlrpclib.py
+13
-3
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/lib/libxmlrpclib.tex
Dosyayı görüntüle @
07529354
...
...
@@ -68,7 +68,10 @@ Python type):
\lineii
{
arrays
}{
Any Python sequence type containing conformable
elements. Arrays are returned as lists
}
\lineii
{
structures
}{
A Python dictionary. Keys must be strings,
values may be any conformable type.
}
values may be any conformable type. Objects
of user-defined classes can be passed in;
only their
\var
{__
dict
__}
attribute is
transmitted.
}
\lineii
{
dates
}{
in seconds since the epoch (pass in an instance of the
\class
{
DateTime
}
class) or a
\class
{
\refmodule
{
datetime
}
.datetime
}
,
...
...
@@ -100,6 +103,10 @@ described below.
compatibility. New code should use
\class
{
ServerProxy
}
.
\versionchanged
[The \var{use_datetime} flag was added]
{
2.5
}
\versionchanged
[Instances of new-style classes can be passed in
if they have an
\var
{__
dict
__}
attribute and don't have a base class
that is marshalled in a special way.
}{
2.6
}
\end{classdesc}
...
...
Lib/test/test_xmlrpc.py
Dosyayı görüntüle @
07529354
...
...
@@ -86,6 +86,15 @@ class XMLRPCTestCase(unittest.TestCase):
s
=
xmlrpclib
.
dumps
((
new_d
,),
methodresponse
=
True
)
self
.
assert_
(
isinstance
(
s
,
str
))
def
test_newstyle_class
(
self
):
class
T
(
object
):
pass
t
=
T
()
t
.
x
=
100
t
.
y
=
"Hello"
((
t2
,),
dummy
)
=
xmlrpclib
.
loads
(
xmlrpclib
.
dumps
((
t
,)))
self
.
assertEquals
(
t2
,
t
.
__dict__
)
def
test_dump_big_long
(
self
):
self
.
assertRaises
(
OverflowError
,
xmlrpclib
.
dumps
,
(
2L
**
99
,))
...
...
Lib/xmlrpclib.py
Dosyayı görüntüle @
07529354
...
...
@@ -630,9 +630,19 @@ class Marshaller:
try
:
f
=
self
.
dispatch
[
type
(
value
)]
except
KeyError
:
raise
TypeError
,
"cannot marshal
%
s objects"
%
type
(
value
)
else
:
f
(
self
,
value
,
write
)
# check if this object can be marshalled as a structure
try
:
value
.
__dict__
except
:
raise
TypeError
,
"cannot marshal
%
s objects"
%
type
(
value
)
# check if this class is a sub-class of a basic type,
# because we don't know how to marshal these types
# (e.g. a string sub-class)
for
type_
in
type
(
value
)
.
__mro__
:
if
type_
in
self
.
dispatch
.
keys
():
raise
TypeError
,
"cannot marshal
%
s objects"
%
type
(
value
)
f
=
self
.
dispatch
[
InstanceType
]
f
(
self
,
value
,
write
)
def
dump_nil
(
self
,
value
,
write
):
if
not
self
.
allow_none
:
...
...
Misc/NEWS
Dosyayı görüntüle @
07529354
...
...
@@ -101,6 +101,9 @@ Core and builtins
Library
-------
- Patch #1070046: Marshal new-style objects like InstanceType
in xmlrpclib.
- cStringIO.truncate(-1) now raises an IOError, like StringIO and
regular files.
...
...
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