Author: Greg Price <[email protected]>
Branch: signatures
Changeset: r59324:f731001d08f0
Date: 2012-12-03 21:13 -0800
http://bitbucket.org/pypy/pypy/changeset/f731001d08f0/
Log: Support Unicode string type in signatures
diff --git a/pypy/annotation/types.py b/pypy/annotation/types.py
--- a/pypy/annotation/types.py
+++ b/pypy/annotation/types.py
@@ -20,6 +20,9 @@
return model.SomeInteger()
+def unicode():
+ return model.SomeUnicodeString()
+
def str():
return model.SomeString()
diff --git a/pypy/rlib/test/test_signature.py b/pypy/rlib/test/test_signature.py
--- a/pypy/rlib/test/test_signature.py
+++ b/pypy/rlib/test/test_signature.py
@@ -88,6 +88,12 @@
return 3.0
assert getsig(f) == [model.SomeLongFloat(), model.SomeSingleFloat(),
model.SomeFloat()]
+def test_signature_unicode():
+ @signature(types.unicode(), returns=types.int())
+ def f(u):
+ return len(u)
+ assert getsig(f) == [model.SomeUnicodeString(), model.SomeInteger()]
+
def test_signature_list():
@signature(types.list(types.int()), returns=types.int())
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit