Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
814820bb
Commit
814820bb
authored
Aug 04, 2008
by
Brett Cannon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove assignment to True/False and use of dict.has_key() to silence warnings
while running under -3.
parent
9bd059ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
Lib/xmlrpclib.py
Lib/xmlrpclib.py
+10
-4
No files found.
Lib/xmlrpclib.py
View file @
814820bb
...
@@ -282,10 +282,13 @@ class Fault(Error):
...
@@ -282,10 +282,13 @@ class Fault(Error):
# @param value A boolean value. Any true value is interpreted as True,
# @param value A boolean value. Any true value is interpreted as True,
# all other values are interpreted as False.
# all other values are interpreted as False.
from
sys
import
modules
mod_dict
=
modules
[
__name__
].
__dict__
if
_bool_is_builtin
:
if
_bool_is_builtin
:
boolean
=
Boolean
=
bool
boolean
=
Boolean
=
bool
# to avoid breaking code which references xmlrpclib.{True,False}
# to avoid breaking code which references xmlrpclib.{True,False}
True
,
False
=
True
,
False
mod_dict
[
'True'
]
=
True
mod_dict
[
'False'
]
=
False
else
:
else
:
class
Boolean
:
class
Boolean
:
"""Boolean-value wrapper.
"""Boolean-value wrapper.
...
@@ -316,7 +319,8 @@ else:
...
@@ -316,7 +319,8 @@ else:
def
__nonzero__
(
self
):
def
__nonzero__
(
self
):
return
self
.
value
return
self
.
value
True
,
False
=
Boolean
(
1
),
Boolean
(
0
)
mod_dict
[
'True'
]
=
Boolean
(
1
)
mod_dict
[
'False'
]
=
Boolean
(
0
)
##
##
# Map true or false value to XML-RPC boolean values.
# Map true or false value to XML-RPC boolean values.
...
@@ -333,6 +337,8 @@ else:
...
@@ -333,6 +337,8 @@ else:
"""Convert any Python value to XML-RPC 'boolean'."""
"""Convert any Python value to XML-RPC 'boolean'."""
return
_truefalse
[
operator
.
truth
(
value
)]
return
_truefalse
[
operator
.
truth
(
value
)]
del
modules
,
mod_dict
##
##
# Wrapper for XML-RPC DateTime values. This converts a time value to
# Wrapper for XML-RPC DateTime values. This converts a time value to
# the format used by XML-RPC.
# the format used by XML-RPC.
...
@@ -744,7 +750,7 @@ class Marshaller:
...
@@ -744,7 +750,7 @@ class Marshaller:
def
dump_array
(
self
,
value
,
write
):
def
dump_array
(
self
,
value
,
write
):
i
=
id
(
value
)
i
=
id
(
value
)
if
self
.
memo
.
has_key
(
i
)
:
if
i
in
self
.
memo
:
raise
TypeError
,
"cannot marshal recursive sequences"
raise
TypeError
,
"cannot marshal recursive sequences"
self
.
memo
[
i
]
=
None
self
.
memo
[
i
]
=
None
dump
=
self
.
__dump
dump
=
self
.
__dump
...
@@ -758,7 +764,7 @@ class Marshaller:
...
@@ -758,7 +764,7 @@ class Marshaller:
def
dump_struct
(
self
,
value
,
write
,
escape
=
escape
):
def
dump_struct
(
self
,
value
,
write
,
escape
=
escape
):
i
=
id
(
value
)
i
=
id
(
value
)
if
self
.
memo
.
has_key
(
i
)
:
if
i
in
self
.
memo
:
raise
TypeError
,
"cannot marshal recursive dictionaries"
raise
TypeError
,
"cannot marshal recursive dictionaries"
self
.
memo
[
i
]
=
None
self
.
memo
[
i
]
=
None
dump
=
self
.
__dump
dump
=
self
.
__dump
...
...
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