[Python-checkins] r64520 - in python/trunk/Lib/multiprocessing: dummy/__init__.py managers.py

benjamin.peterson python-checkins at python.org
Wed Jun 25 14:44:29 CEST 2008


Author: benjamin.peterson
Date: Wed Jun 25 14:44:29 2008
New Revision: 64520
Log:
get rid of 2.6/3.0 switch statements in multiprocessing
Modified:
 python/trunk/Lib/multiprocessing/dummy/__init__.py
 python/trunk/Lib/multiprocessing/managers.py
Modified: python/trunk/Lib/multiprocessing/dummy/__init__.py
==============================================================================
--- python/trunk/Lib/multiprocessing/dummy/__init__.py	(original)
+++ python/trunk/Lib/multiprocessing/dummy/__init__.py	Wed Jun 25 14:44:29 2008
@@ -53,30 +53,18 @@
 else:
 return None
 
- # XXX
- if sys.version_info < (3, 0):
- is_alive = threading.Thread.is_alive.im_func
- get_name = threading.Thread.get_name.im_func
- set_name = threading.Thread.set_name.im_func
- is_daemon = threading.Thread.is_daemon.im_func
- set_daemon = threading.Thread.set_daemon.im_func
- else:
- is_alive = threading.Thread.is_alive
- get_name = threading.Thread.get_name
- set_name = threading.Thread.set_name
- is_daemon = threading.Thread.is_daemon
- set_daemon = threading.Thread.set_daemon
+ is_alive = threading.Thread.is_alive.im_func
+ get_name = threading.Thread.get_name.im_func
+ set_name = threading.Thread.set_name.im_func
+ is_daemon = threading.Thread.is_daemon.im_func
+ set_daemon = threading.Thread.set_daemon.im_func
 
 #
 #
 #
 
 class Condition(threading._Condition):
- # XXX
- if sys.version_info < (3, 0):
- notify_all = threading._Condition.notify_all.im_func
- else:
- notify_all = threading._Condition.notify_all
+ notify_all = threading._Condition.notify_all.im_func
 
 #
 #
Modified: python/trunk/Lib/multiprocessing/managers.py
==============================================================================
--- python/trunk/Lib/multiprocessing/managers.py	(original)
+++ python/trunk/Lib/multiprocessing/managers.py	Wed Jun 25 14:44:29 2008
@@ -41,11 +41,6 @@
 copy_reg.pickle(array.array, reduce_array)
 
 view_types = [type(getattr({}, name)()) for name in ('items','keys','values')]
-if view_types[0] is not list: # XXX only needed in Py3.0
- def rebuild_as_list(obj):
- return list, (list(obj),)
- for view_type in view_types:
- copy_reg.pickle(view_type, rebuild_as_list)
 
 #
 # Type for identifying shared objects


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /