# HG changeset patch # User Bobby Impollonia # Date 1289685992 28800 # Node ID eea94db3eb13e0ac9a20217e6b6d8972a138810d # Parent 147a7ffccb03ca3303589b1e8120ae0e78ad1ae9 Fix pickle benchmark compatibility with py3k diff -r 147a7ffccb03 -r eea94db3eb13 performance/bm_pickle.py --- a/performance/bm_pickle.py Fri Nov 12 21:52:49 2010 +0100 +++ b/performance/bm_pickle.py Sat Nov 13 14:06:32 2010 -0800 @@ -27,46 +27,46 @@ # Local imports import util from compat import ( - xrange, bytes, unicode, int_types, long, maxint) + xrange, bytes, unicode, int_, maxint) DICT = { - 'ads_flags': long(0), + 'ads_flags': int_(0), 'age': 18, 'birthday': datetime.date(1980, 5, 7), - 'bulletin_count': long(0), - 'comment_count': long(0), + 'bulletin_count': int_(0), + 'comment_count': int_(0), 'country': 'BR', 'encrypted_id': 'G9urXXAJwjE', - 'favorite_count': long(9), + 'favorite_count': int_(9), 'first_name': '', - 'flags': long(412317970704), - 'friend_count': long(0), + 'flags': int_(412317970704), + 'friend_count': int_(0), 'gender': 'm', 'gender_for_display': 'Male', - 'id': long(302935349), - 'is_custom_profile_icon': long(0), + 'id': int_(302935349), + 'is_custom_profile_icon': int_(0), 'last_name': '', 'locale_preference': 'pt_BR', - 'member': long(0), + 'member': int_(0), 'tags': ['a', 'b', 'c', 'd', 'e', 'f', 'g'], - 'profile_foo_id': long(827119638), + 'profile_foo_id': int_(827119638), 'secure_encrypted_id': 'Z_xxx2dYx3t4YAdnmfgyKw', - 'session_number': long(2), + 'session_number': int_(2), 'signup_id': '201-19225-223', 'status': 'A', 'theme': 1, - 'time_created': long(1225237014), - 'time_updated': long(1233134493), - 'unread_message_count': long(0), + 'time_created': int_(1225237014), + 'time_updated': int_(1233134493), + 'unread_message_count': int_(0), 'user_group': '0', 'username': 'collinwinter', - 'play_count': long(9), - 'view_count': long(7), + 'play_count': int_(9), + 'view_count': int_(7), 'zip': ''} TUPLE = ( - [long(x) for x in + [int_(x) for x in [265867233, 265868503, 265252341, 265243910, 265879514, 266219766, 266021701, 265843726, 265592821, 265246784, 265853180, 45526486, 265463699, 265848143, 265863062, @@ -77,7 +77,7 @@ new_dict = dict(orig_dict) for key, value in new_dict.items(): rand_val = random_source.random() * maxint - if isinstance(key, int_types + (bytes, unicode)): + if isinstance(key, (bytes, unicode, int, int_)): new_dict[key] = type(key)(rand_val) return new_dict diff -r 147a7ffccb03 -r eea94db3eb13 performance/compat.py --- a/performance/compat.py Fri Nov 12 21:52:49 2010 +0100 +++ b/performance/compat.py Sat Nov 13 14:06:32 2010 -0800 @@ -9,7 +9,7 @@ bytes = str unicode = unicode xrange = xrange - long = long + int_ = long maxint = sys.maxint reduce = reduce imap = itertools.imap @@ -32,7 +32,7 @@ bytes = bytes unicode = str xrange = range - long = int + int_ = int maxint = sys.maxsize # good enough reduce = functools.reduce imap = map