[pypy-commit] pypy default: Kill LLSupport from rpython/rtyper/module/support.py.

mjacob pypy.commits at gmail.com
Sat Feb 20 07:23:00 EST 2016


Author: Manuel Jacob <me at manueljacob.de>
Branch: 
Changeset: r82341:ecb5a8d71071
Date: 2016-02-20 12:41 +0100
http://bitbucket.org/pypy/pypy/changeset/ecb5a8d71071/

Log:	Kill LLSupport from rpython/rtyper/module/support.py.

diff --git a/rpython/jit/metainterp/test/test_tlc.py b/rpython/jit/metainterp/test/test_tlc.py
--- a/rpython/jit/metainterp/test/test_tlc.py
+++ b/rpython/jit/metainterp/test/test_tlc.py
@@ -1,5 +1,4 @@
 import py
-from rpython.rtyper.module.support import LLSupport
 
 from rpython.jit.tl import tlc
 
diff --git a/rpython/rtyper/module/support.py b/rpython/rtyper/module/support.py
--- a/rpython/rtyper/module/support.py
+++ b/rpython/rtyper/module/support.py
@@ -8,42 +8,6 @@
 _WIN32 = sys.platform.startswith('win')
 UNDERSCORE_ON_WIN32 = '_' if _WIN32 else ''
 
-# utility conversion functions
-class LLSupport:
-    _mixin_ = True
-
-    def to_rstr(s):
-        from rpython.rtyper.lltypesystem.rstr import STR, mallocstr
-        if s is None:
-            return lltype.nullptr(STR)
-        p = mallocstr(len(s))
-        for i in range(len(s)):
-            p.chars[i] = s[i]
-        return p
-    to_rstr = staticmethod(to_rstr)
-
-    def to_runicode(s):
-        from rpython.rtyper.lltypesystem.rstr import UNICODE, mallocunicode
-        if s is None:
-            return lltype.nullptr(UNICODE)
-        p = mallocunicode(len(s))
-        for i in range(len(s)):
-            p.chars[i] = s[i]
-        return p
-    to_runicode = staticmethod(to_runicode)
-
-    def from_rstr(rs):
-        if not rs:   # null pointer
-            return None
-        else:
-            return ''.join([rs.chars[i] for i in range(len(rs.chars))])
-    from_rstr = staticmethod(from_rstr)
-
-    def from_rstr_nonnull(rs):
-        assert rs
-        return ''.join([rs.chars[i] for i in range(len(rs.chars))])
-    from_rstr_nonnull = staticmethod(from_rstr_nonnull)
-
 
 class StringTraits:
     str = str
diff --git a/rpython/rtyper/test/tool.py b/rpython/rtyper/test/tool.py
--- a/rpython/rtyper/test/tool.py
+++ b/rpython/rtyper/test/tool.py
@@ -46,12 +46,22 @@
         return u''.join(s.chars)
 
     def string_to_ll(self, s):
-        from rpython.rtyper.module.support import LLSupport
-        return LLSupport.to_rstr(s)
+        from rpython.rtyper.lltypesystem.rstr import STR, mallocstr
+        if s is None:
+            return lltype.nullptr(STR)
+        p = mallocstr(len(s))
+        for i in range(len(s)):
+            p.chars[i] = s[i]
+        return p
 
     def unicode_to_ll(self, s):
-        from rpython.rtyper.module.support import LLSupport
-        return LLSupport.to_runicode(s)
+        from rpython.rtyper.lltypesystem.rstr import UNICODE, mallocunicode
+        if s is None:
+            return lltype.nullptr(UNICODE)
+        p = mallocunicode(len(s))
+        for i in range(len(s)):
+            p.chars[i] = s[i]
+        return p
 
     def ll_to_list(self, l):
         r = []


More information about the pypy-commit mailing list