@@ -141,19 +141,6 @@ def list_public_methods(obj):
141141 if not member .startswith ('_' ) and
142142 hasattr (getattr (obj , member ), '__call__' )]
143143
144- def remove_duplicates (lst ):
145- """remove_duplicates([2,2,2,1,3,3]) => [3,1,2]
146-
147- Returns a copy of a list without duplicates. Every list
148- item must be hashable and the order of the items in the
149- resulting list is not defined.
150- """
151- u = {}
152- for x in lst :
153- u [x ] = 1
154-
155- return u .keys ()
156-
157144class SimpleXMLRPCDispatcher :
158145 """Mix-in class that dispatches XML-RPC requests.
159146
@@ -276,23 +263,18 @@ def system_listMethods(self):
276263
277264 Returns a list of the methods supported by the server."""
278265
279- methods = self .funcs .keys ()
266+ methods = set ( self .funcs .keys () )
280267 if self .instance is not None :
281268 # Instance can implement _listMethod to return a list of
282269 # methods
283270 if hasattr (self .instance , '_listMethods' ):
284- methods = remove_duplicates (
285- methods + self .instance ._listMethods ()
286- )
271+ methods |= set (self .instance ._listMethods ())
287272 # if the instance has a _dispatch method then we
288273 # don't have enough information to provide a list
289274 # of methods
290275 elif not hasattr (self .instance , '_dispatch' ):
291- methods = remove_duplicates (
292- methods + list_public_methods (self .instance )
293- )
294- methods .sort ()
295- return methods
276+ methods |= set (list_public_methods (self .instance ))
277+ return sorted (methods )
296278
297279 def system_methodSignature (self , method_name ):
298280 """system.methodSignature('add') => [double, int, int]
@@ -459,7 +441,7 @@ def do_POST(self):
459441 chunk_size = min (size_remaining , max_chunk_size )
460442 L .append (self .rfile .read (chunk_size ))
461443 size_remaining -= len (L [- 1 ])
462- data = '' .join (L )
444+ data = b '' .join (L )
463445
464446 # In previous versions of SimpleXMLRPCServer, _dispatch
465447 # could be overridden in this class, instead of in
0 commit comments