[pypy-svn] r27092 - in pypy/dist/pypy/rpython: . lltypesystem

ac at codespeak.net ac at codespeak.net
Thu May 11 20:05:41 CEST 2006


Author: ac
Date: Thu May 11 20:05:40 2006
New Revision: 27092

Modified:
   pypy/dist/pypy/rpython/lltypesystem/rstr.py
   pypy/dist/pypy/rpython/rarithmetic.py
Log:
Python2.3-ify.

Modified: pypy/dist/pypy/rpython/lltypesystem/rstr.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/rstr.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/rstr.py	Thu May 11 20:05:40 2006
@@ -404,7 +404,6 @@
                 return i
         return -1
 
-    @classmethod
     def ll_find(cls, s1, s2, start, end):
         """Knuth Morris Prath algorithm for substring match"""
         len2 = len(s2.chars)
@@ -448,8 +447,8 @@
                     m = m + i - e
                     i = e
         return -1
+    ll_find = classmethod(ll_find)
 
-    @classmethod
     def ll_rfind(cls, s1, s2, start, end):
         """Reversed version of ll_find()"""
         len2 = len(s2.chars)
@@ -491,6 +490,7 @@
                     m = m - i + e
                     i = e
         return -1
+    ll_rfind = classmethod(ll_rfind)
 
     def ll_join_strs(length, items):
         num_items = length
@@ -657,7 +657,6 @@
             raise ValueError
         return sign * val
 
-    @classmethod
     def do_stringformat(cls, hop, sourcevarsrepr):
         s_str = hop.args_s[0]
         assert s_str.is_constant()
@@ -706,6 +705,7 @@
 
         hop.exception_cannot_occur()   # to ignore the ZeroDivisionError of '%'
         return hop.gendirectcall(cls.ll_join_strs, size, vtemp)
+    do_stringformat = classmethod(do_stringformat)
 
     def parse_fmt_string(fmt):
         # we support x, d, s, f, [r]

Modified: pypy/dist/pypy/rpython/rarithmetic.py
==============================================================================
--- pypy/dist/pypy/rpython/rarithmetic.py	(original)
+++ pypy/dist/pypy/rpython/rarithmetic.py	Thu May 11 20:05:40 2006
@@ -272,7 +272,7 @@
         base_int_type = signed_int
     else:
         base_int_type = unsigned_int
-    mask = (1 << bits) - 1
+    mask = (2 ** bits) - 1
     if name is None:
         raise TypeError('No predefined %sint%d'%(['u', ''][sign], bits))
     int_type = _inttypes[sign, bits] = type(name, (base_int_type,), {'MASK': mask,



More information about the Pypy-commit mailing list