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
fe59dc1b
Kaydet (Commit)
fe59dc1b
authored
Şub 07, 2005
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Revert previous checkin.
üst
f715366f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
34 deletions
+34
-34
pickle.py
Lib/pickle.py
+15
-15
xmlrpclib.py
Lib/xmlrpclib.py
+19
-19
No files found.
Lib/pickle.py
Dosyayı görüntüle @
fe59dc1b
...
@@ -288,7 +288,7 @@ class Pickler:
...
@@ -288,7 +288,7 @@ class Pickler:
# Check for a class with a custom metaclass; treat as regular class
# Check for a class with a custom metaclass; treat as regular class
try
:
try
:
issc
=
issubclass
(
t
,
t
ype
)
issc
=
issubclass
(
t
,
TypeT
ype
)
except
TypeError
:
# t is not a class (old Boost; see SF #502085)
except
TypeError
:
# t is not a class (old Boost; see SF #502085)
issc
=
0
issc
=
0
if
issc
:
if
issc
:
...
@@ -313,12 +313,12 @@ class Pickler:
...
@@ -313,12 +313,12 @@ class Pickler:
(
t
.
__name__
,
obj
))
(
t
.
__name__
,
obj
))
# Check for string returned by reduce(), meaning "save as global"
# Check for string returned by reduce(), meaning "save as global"
if
type
(
rv
)
is
str
:
if
type
(
rv
)
is
StringType
:
self
.
save_global
(
obj
,
rv
)
self
.
save_global
(
obj
,
rv
)
return
return
# Assert that reduce() returned a tuple
# Assert that reduce() returned a tuple
if
type
(
rv
)
is
not
tupl
e
:
if
type
(
rv
)
is
not
TupleTyp
e
:
raise
PicklingError
(
"
%
s must return string or tuple"
%
reduce
)
raise
PicklingError
(
"
%
s must return string or tuple"
%
reduce
)
# Assert that it returned an appropriately sized tuple
# Assert that it returned an appropriately sized tuple
...
@@ -347,7 +347,7 @@ class Pickler:
...
@@ -347,7 +347,7 @@ class Pickler:
# This API is called by some subclasses
# This API is called by some subclasses
# Assert that args is a tuple or None
# Assert that args is a tuple or None
if
not
isinstance
(
args
,
tupl
e
):
if
not
isinstance
(
args
,
TupleTyp
e
):
raise
PicklingError
(
"args from reduce() should be a tuple"
)
raise
PicklingError
(
"args from reduce() should be a tuple"
)
# Assert that func is callable
# Assert that func is callable
...
@@ -425,7 +425,7 @@ class Pickler:
...
@@ -425,7 +425,7 @@ class Pickler:
def
save_none
(
self
,
obj
):
def
save_none
(
self
,
obj
):
self
.
write
(
NONE
)
self
.
write
(
NONE
)
dispatch
[
type
(
None
)
]
=
save_none
dispatch
[
NoneType
]
=
save_none
def
save_bool
(
self
,
obj
):
def
save_bool
(
self
,
obj
):
if
self
.
proto
>=
2
:
if
self
.
proto
>=
2
:
...
@@ -456,7 +456,7 @@ class Pickler:
...
@@ -456,7 +456,7 @@ class Pickler:
return
return
# Text pickle, or int too big to fit in signed 4-byte format.
# Text pickle, or int too big to fit in signed 4-byte format.
self
.
write
(
INT
+
repr
(
obj
)
+
'
\n
'
)
self
.
write
(
INT
+
repr
(
obj
)
+
'
\n
'
)
dispatch
[
int
]
=
save_int
dispatch
[
IntType
]
=
save_int
def
save_long
(
self
,
obj
,
pack
=
struct
.
pack
):
def
save_long
(
self
,
obj
,
pack
=
struct
.
pack
):
if
self
.
proto
>=
2
:
if
self
.
proto
>=
2
:
...
@@ -468,14 +468,14 @@ class Pickler:
...
@@ -468,14 +468,14 @@ class Pickler:
self
.
write
(
LONG4
+
pack
(
"<i"
,
n
)
+
bytes
)
self
.
write
(
LONG4
+
pack
(
"<i"
,
n
)
+
bytes
)
return
return
self
.
write
(
LONG
+
repr
(
obj
)
+
'
\n
'
)
self
.
write
(
LONG
+
repr
(
obj
)
+
'
\n
'
)
dispatch
[
long
]
=
save_long
dispatch
[
LongType
]
=
save_long
def
save_float
(
self
,
obj
,
pack
=
struct
.
pack
):
def
save_float
(
self
,
obj
,
pack
=
struct
.
pack
):
if
self
.
bin
:
if
self
.
bin
:
self
.
write
(
BINFLOAT
+
pack
(
'>d'
,
obj
))
self
.
write
(
BINFLOAT
+
pack
(
'>d'
,
obj
))
else
:
else
:
self
.
write
(
FLOAT
+
repr
(
obj
)
+
'
\n
'
)
self
.
write
(
FLOAT
+
repr
(
obj
)
+
'
\n
'
)
dispatch
[
float
]
=
save_float
dispatch
[
FloatType
]
=
save_float
def
save_string
(
self
,
obj
,
pack
=
struct
.
pack
):
def
save_string
(
self
,
obj
,
pack
=
struct
.
pack
):
if
self
.
bin
:
if
self
.
bin
:
...
@@ -487,7 +487,7 @@ class Pickler:
...
@@ -487,7 +487,7 @@ class Pickler:
else
:
else
:
self
.
write
(
STRING
+
repr
(
obj
)
+
'
\n
'
)
self
.
write
(
STRING
+
repr
(
obj
)
+
'
\n
'
)
self
.
memoize
(
obj
)
self
.
memoize
(
obj
)
dispatch
[
str
]
=
save_string
dispatch
[
StringType
]
=
save_string
def
save_unicode
(
self
,
obj
,
pack
=
struct
.
pack
):
def
save_unicode
(
self
,
obj
,
pack
=
struct
.
pack
):
if
self
.
bin
:
if
self
.
bin
:
...
@@ -501,7 +501,7 @@ class Pickler:
...
@@ -501,7 +501,7 @@ class Pickler:
self
.
memoize
(
obj
)
self
.
memoize
(
obj
)
dispatch
[
UnicodeType
]
=
save_unicode
dispatch
[
UnicodeType
]
=
save_unicode
if
str
==
UnicodeType
:
if
StringType
==
UnicodeType
:
# This is true for Jython
# This is true for Jython
def
save_string
(
self
,
obj
,
pack
=
struct
.
pack
):
def
save_string
(
self
,
obj
,
pack
=
struct
.
pack
):
unicode
=
obj
.
isunicode
()
unicode
=
obj
.
isunicode
()
...
@@ -527,7 +527,7 @@ class Pickler:
...
@@ -527,7 +527,7 @@ class Pickler:
else
:
else
:
self
.
write
(
STRING
+
repr
(
obj
)
+
'
\n
'
)
self
.
write
(
STRING
+
repr
(
obj
)
+
'
\n
'
)
self
.
memoize
(
obj
)
self
.
memoize
(
obj
)
dispatch
[
str
]
=
save_string
dispatch
[
StringType
]
=
save_string
def
save_tuple
(
self
,
obj
):
def
save_tuple
(
self
,
obj
):
write
=
self
.
write
write
=
self
.
write
...
@@ -580,7 +580,7 @@ class Pickler:
...
@@ -580,7 +580,7 @@ class Pickler:
self
.
write
(
TUPLE
)
self
.
write
(
TUPLE
)
self
.
memoize
(
obj
)
self
.
memoize
(
obj
)
dispatch
[
tupl
e
]
=
save_tuple
dispatch
[
TupleTyp
e
]
=
save_tuple
# save_empty_tuple() isn't used by anything in Python 2.3. However, I
# save_empty_tuple() isn't used by anything in Python 2.3. However, I
# found a Pickler subclass in Zope3 that calls it, so it's not harmless
# found a Pickler subclass in Zope3 that calls it, so it's not harmless
...
@@ -599,7 +599,7 @@ class Pickler:
...
@@ -599,7 +599,7 @@ class Pickler:
self
.
memoize
(
obj
)
self
.
memoize
(
obj
)
self
.
_batch_appends
(
iter
(
obj
))
self
.
_batch_appends
(
iter
(
obj
))
dispatch
[
list
]
=
save_list
dispatch
[
ListType
]
=
save_list
# Keep in synch with cPickle's BATCHSIZE. Nothing will break if it gets
# Keep in synch with cPickle's BATCHSIZE. Nothing will break if it gets
# out of synch, though.
# out of synch, though.
...
@@ -648,7 +648,7 @@ class Pickler:
...
@@ -648,7 +648,7 @@ class Pickler:
self
.
memoize
(
obj
)
self
.
memoize
(
obj
)
self
.
_batch_setitems
(
obj
.
iteritems
())
self
.
_batch_setitems
(
obj
.
iteritems
())
dispatch
[
dict
]
=
save_dict
dispatch
[
DictionaryType
]
=
save_dict
if
not
PyStringMap
is
None
:
if
not
PyStringMap
is
None
:
dispatch
[
PyStringMap
]
=
save_dict
dispatch
[
PyStringMap
]
=
save_dict
...
@@ -770,7 +770,7 @@ class Pickler:
...
@@ -770,7 +770,7 @@ class Pickler:
dispatch
[
ClassType
]
=
save_global
dispatch
[
ClassType
]
=
save_global
dispatch
[
FunctionType
]
=
save_global
dispatch
[
FunctionType
]
=
save_global
dispatch
[
BuiltinFunctionType
]
=
save_global
dispatch
[
BuiltinFunctionType
]
=
save_global
dispatch
[
t
ype
]
=
save_global
dispatch
[
TypeT
ype
]
=
save_global
# Pickling helpers
# Pickling helpers
...
...
Lib/xmlrpclib.py
Dosyayı görüntüle @
fe59dc1b
...
@@ -138,7 +138,7 @@ Exported functions:
...
@@ -138,7 +138,7 @@ Exported functions:
import
re
,
string
,
time
,
operator
import
re
,
string
,
time
,
operator
from
types
import
InstanceType
from
types
import
*
# --------------------------------------------------------------------
# --------------------------------------------------------------------
# Internal stuff
# Internal stuff
...
@@ -348,8 +348,8 @@ class DateTime:
...
@@ -348,8 +348,8 @@ class DateTime:
"""
"""
def
__init__
(
self
,
value
=
0
):
def
__init__
(
self
,
value
=
0
):
if
not
isinstance
(
value
,
str
):
if
not
isinstance
(
value
,
StringType
):
if
not
isinstance
(
value
,
(
tupl
e
,
time
.
struct_time
)):
if
not
isinstance
(
value
,
(
TupleTyp
e
,
time
.
struct_time
)):
if
value
==
0
:
if
value
==
0
:
value
=
time
.
time
()
value
=
time
.
time
()
value
=
time
.
localtime
(
value
)
value
=
time
.
localtime
(
value
)
...
@@ -618,7 +618,7 @@ class Marshaller:
...
@@ -618,7 +618,7 @@ class Marshaller:
if
not
self
.
allow_none
:
if
not
self
.
allow_none
:
raise
TypeError
,
"cannot marshal None unless allow_none is enabled"
raise
TypeError
,
"cannot marshal None unless allow_none is enabled"
write
(
"<value><nil/></value>"
)
write
(
"<value><nil/></value>"
)
dispatch
[
type
(
None
)
]
=
dump_nil
dispatch
[
NoneType
]
=
dump_nil
def
dump_int
(
self
,
value
,
write
):
def
dump_int
(
self
,
value
,
write
):
# in case ints are > 32 bits
# in case ints are > 32 bits
...
@@ -627,7 +627,7 @@ class Marshaller:
...
@@ -627,7 +627,7 @@ class Marshaller:
write
(
"<value><int>"
)
write
(
"<value><int>"
)
write
(
str
(
value
))
write
(
str
(
value
))
write
(
"</int></value>
\n
"
)
write
(
"</int></value>
\n
"
)
dispatch
[
int
]
=
dump_int
dispatch
[
IntType
]
=
dump_int
if
_bool_is_builtin
:
if
_bool_is_builtin
:
def
dump_bool
(
self
,
value
,
write
):
def
dump_bool
(
self
,
value
,
write
):
...
@@ -642,19 +642,19 @@ class Marshaller:
...
@@ -642,19 +642,19 @@ class Marshaller:
write
(
"<value><int>"
)
write
(
"<value><int>"
)
write
(
str
(
int
(
value
)))
write
(
str
(
int
(
value
)))
write
(
"</int></value>
\n
"
)
write
(
"</int></value>
\n
"
)
dispatch
[
long
]
=
dump_long
dispatch
[
LongType
]
=
dump_long
def
dump_double
(
self
,
value
,
write
):
def
dump_double
(
self
,
value
,
write
):
write
(
"<value><double>"
)
write
(
"<value><double>"
)
write
(
repr
(
value
))
write
(
repr
(
value
))
write
(
"</double></value>
\n
"
)
write
(
"</double></value>
\n
"
)
dispatch
[
float
]
=
dump_double
dispatch
[
FloatType
]
=
dump_double
def
dump_string
(
self
,
value
,
write
,
escape
=
escape
):
def
dump_string
(
self
,
value
,
write
,
escape
=
escape
):
write
(
"<value><string>"
)
write
(
"<value><string>"
)
write
(
escape
(
value
))
write
(
escape
(
value
))
write
(
"</string></value>
\n
"
)
write
(
"</string></value>
\n
"
)
dispatch
[
str
]
=
dump_string
dispatch
[
StringType
]
=
dump_string
if
unicode
:
if
unicode
:
def
dump_unicode
(
self
,
value
,
write
,
escape
=
escape
):
def
dump_unicode
(
self
,
value
,
write
,
escape
=
escape
):
...
@@ -662,7 +662,7 @@ class Marshaller:
...
@@ -662,7 +662,7 @@ class Marshaller:
write
(
"<value><string>"
)
write
(
"<value><string>"
)
write
(
escape
(
value
))
write
(
escape
(
value
))
write
(
"</string></value>
\n
"
)
write
(
"</string></value>
\n
"
)
dispatch
[
unicod
e
]
=
dump_unicode
dispatch
[
UnicodeTyp
e
]
=
dump_unicode
def
dump_array
(
self
,
value
,
write
):
def
dump_array
(
self
,
value
,
write
):
i
=
id
(
value
)
i
=
id
(
value
)
...
@@ -675,8 +675,8 @@ class Marshaller:
...
@@ -675,8 +675,8 @@ class Marshaller:
dump
(
v
,
write
)
dump
(
v
,
write
)
write
(
"</data></array></value>
\n
"
)
write
(
"</data></array></value>
\n
"
)
del
self
.
memo
[
i
]
del
self
.
memo
[
i
]
dispatch
[
tupl
e
]
=
dump_array
dispatch
[
TupleTyp
e
]
=
dump_array
dispatch
[
list
]
=
dump_array
dispatch
[
ListType
]
=
dump_array
def
dump_struct
(
self
,
value
,
write
,
escape
=
escape
):
def
dump_struct
(
self
,
value
,
write
,
escape
=
escape
):
i
=
id
(
value
)
i
=
id
(
value
)
...
@@ -687,8 +687,8 @@ class Marshaller:
...
@@ -687,8 +687,8 @@ class Marshaller:
write
(
"<value><struct>
\n
"
)
write
(
"<value><struct>
\n
"
)
for
k
,
v
in
value
.
items
():
for
k
,
v
in
value
.
items
():
write
(
"<member>
\n
"
)
write
(
"<member>
\n
"
)
if
type
(
k
)
is
not
str
:
if
type
(
k
)
is
not
StringType
:
if
unicode
and
type
(
k
)
is
unicod
e
:
if
unicode
and
type
(
k
)
is
UnicodeTyp
e
:
k
=
k
.
encode
(
self
.
encoding
)
k
=
k
.
encode
(
self
.
encoding
)
else
:
else
:
raise
TypeError
,
"dictionary key must be string"
raise
TypeError
,
"dictionary key must be string"
...
@@ -697,7 +697,7 @@ class Marshaller:
...
@@ -697,7 +697,7 @@ class Marshaller:
write
(
"</member>
\n
"
)
write
(
"</member>
\n
"
)
write
(
"</struct></value>
\n
"
)
write
(
"</struct></value>
\n
"
)
del
self
.
memo
[
i
]
del
self
.
memo
[
i
]
dispatch
[
dict
]
=
dump_struct
dispatch
[
DictType
]
=
dump_struct
def
dump_instance
(
self
,
value
,
write
):
def
dump_instance
(
self
,
value
,
write
):
# check for special wrappers
# check for special wrappers
...
@@ -1010,12 +1010,12 @@ def dumps(params, methodname=None, methodresponse=None, encoding=None,
...
@@ -1010,12 +1010,12 @@ def dumps(params, methodname=None, methodresponse=None, encoding=None,
where necessary.
where necessary.
"""
"""
assert
isinstance
(
params
,
tupl
e
)
or
isinstance
(
params
,
Fault
),
\
assert
isinstance
(
params
,
TupleTyp
e
)
or
isinstance
(
params
,
Fault
),
\
"argument must be tuple or Fault instance"
"argument must be tuple or Fault instance"
if
isinstance
(
params
,
Fault
):
if
isinstance
(
params
,
Fault
):
methodresponse
=
1
methodresponse
=
1
elif
methodresponse
and
isinstance
(
params
,
tupl
e
):
elif
methodresponse
and
isinstance
(
params
,
TupleTyp
e
):
assert
len
(
params
)
==
1
,
"response tuple must be a singleton"
assert
len
(
params
)
==
1
,
"response tuple must be a singleton"
if
not
encoding
:
if
not
encoding
:
...
@@ -1036,7 +1036,7 @@ def dumps(params, methodname=None, methodresponse=None, encoding=None,
...
@@ -1036,7 +1036,7 @@ def dumps(params, methodname=None, methodresponse=None, encoding=None,
# standard XML-RPC wrappings
# standard XML-RPC wrappings
if
methodname
:
if
methodname
:
# a method call
# a method call
if
not
isinstance
(
methodname
,
str
):
if
not
isinstance
(
methodname
,
StringType
):
methodname
=
methodname
.
encode
(
encoding
)
methodname
=
methodname
.
encode
(
encoding
)
data
=
(
data
=
(
xmlheader
,
xmlheader
,
...
@@ -1168,7 +1168,7 @@ class Transport:
...
@@ -1168,7 +1168,7 @@ class Transport:
def
get_host_info
(
self
,
host
):
def
get_host_info
(
self
,
host
):
x509
=
{}
x509
=
{}
if
isinstance
(
host
,
tupl
e
):
if
isinstance
(
host
,
TupleTyp
e
):
host
,
x509
=
host
host
,
x509
=
host
import
urllib
import
urllib
...
@@ -1218,7 +1218,7 @@ class Transport:
...
@@ -1218,7 +1218,7 @@ class Transport:
host
,
extra_headers
,
x509
=
self
.
get_host_info
(
host
)
host
,
extra_headers
,
x509
=
self
.
get_host_info
(
host
)
connection
.
putheader
(
"Host"
,
host
)
connection
.
putheader
(
"Host"
,
host
)
if
extra_headers
:
if
extra_headers
:
if
isinstance
(
extra_headers
,
dict
):
if
isinstance
(
extra_headers
,
DictType
):
extra_headers
=
extra_headers
.
items
()
extra_headers
=
extra_headers
.
items
()
for
key
,
value
in
extra_headers
:
for
key
,
value
in
extra_headers
:
connection
.
putheader
(
key
,
value
)
connection
.
putheader
(
key
,
value
)
...
...
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