Commits

Amaury Forgeot d'Arc committed 5f3eacb Merge

hg merge default

Comments (0)

Files changed (6)

rpython/annotator/annrpython.py

         if policy is None:
             from rpython.annotator.policy import AnnotatorPolicy
             policy = AnnotatorPolicy()
+            # XXX hack
+            annmodel.TLS.check_str_without_nul = (
+                self.translator.config.translation.check_str_without_nul)
         graph, inputcells = self.get_call_parameters(function, args_s, policy)
         self.build_graph_types(graph, inputcells, complete_now=False)
         self.complete_helpers(policy)

rpython/rlib/test/test_jit.py

     assert driver.reds == ['a', 'b']
     assert driver.numreds == 2
 
-@py.test.mark.xfail(reason="@inline off: see skipped failures in test_warmspot.")
 def test_jitdriver_inline():
+    py.test.skip("@inline off: see skipped failures in test_warmspot.")
     driver = JitDriver(greens=[], reds='auto')
     calls = []
     def foo(a, b):
         ('bar', 40, 2),
         ]
 
-@py.test.mark.xfail(reason="@inline off: see skipped failures in test_warmspot.")
 def test_jitdriver_clone():
+    py.test.skip("@inline off: see skipped failures in test_warmspot.")
     def bar(): pass
     def foo(): pass
     driver = JitDriver(greens=[], reds=[])

rpython/rlib/test/test_rposix.py

         assert rposix.is_valid_fd(fd) == 1
         fid.close()
         assert rposix.is_valid_fd(fd) == 0
+
+    def test_putenv(self):
+        def f():
+            rposix.putenv(self.path, self.path)
+            rposix.unsetenv(self.path)
+
+        interpret(f, []) # does not crash

rpython/rlib/test/test_signature.py

 
 def annotate_at(f, policy=None):
     t = TranslationContext()
+    t.config.translation.check_str_without_nul = True
     a = t.buildannotator(policy=policy)
     a.annotate_helper(f, [model.s_ImpossibleValue]*f.func_code.co_argcount, policy=policy)
     return a
         return len(u)
     assert getsig(f) == [model.SomeUnicodeString(), model.SomeInteger()]
 
+def test_str0():
+    @signature(types.unicode0(), returns=types.str0())
+    def f(u):
+        return 'str'
+    assert getsig(f) == [model.SomeUnicodeString(no_nul=True),
+                         model.SomeString(no_nul=True)]
 
 def test_ptr():
     policy = LowLevelAnnotatorPolicy()

rpython/rtyper/rstr.py

                                           startingpos, endingpos):
         raise UnicodeEncodeError(encoding, u, startingpos, endingpos, msg)
     
-
 class __extend__(annmodel.SomeString):
     def rtyper_makerepr(self, rtyper):
         return rtyper.type_system.rstr.string_repr

rpython/rtyper/test/test_runicode.py

 
         assert self.ll_to_string(self.interpret(f, [38])) == f(38)
 
+        def g(n):
+            x = u'\ud800' + unichr(n)
+            return x.encode('utf-8')
+
+        self.interpret_raises(UnicodeEncodeError, g, [38])
+
     def test_utf_8_encoding_annotation(self):
         from rpython.rlib.runicode import unicode_encode_utf_8
         def errorhandler(errors, encoding, msg, u,