summaryrefslogtreecommitdiff
path: root/sys/lib/python/test/test_getargs.py
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@localhost>2011-05-03 11:25:13 +0000
committercinap_lenrek <cinap_lenrek@localhost>2011-05-03 11:25:13 +0000
commit458120dd40db6b4df55a4e96b650e16798ef06a0 (patch)
tree8f82685be24fef97e715c6f5ca4c68d34d5074ee /sys/lib/python/test/test_getargs.py
parent3a742c699f6806c1145aea5149bf15de15a0afd7 (diff)
add hg and python
Diffstat (limited to 'sys/lib/python/test/test_getargs.py')
-rw-r--r--sys/lib/python/test/test_getargs.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/sys/lib/python/test/test_getargs.py b/sys/lib/python/test/test_getargs.py
new file mode 100644
index 000000000..4ce34bc4f
--- /dev/null
+++ b/sys/lib/python/test/test_getargs.py
@@ -0,0 +1,24 @@
+"""Test the internal getargs.c implementation
+
+ PyArg_ParseTuple() is defined here.
+
+The test here is not intended to test all of the module, just the
+single case that failed between 2.1 and 2.2a2.
+"""
+
+# marshal.loads() uses PyArg_ParseTuple(args, "s#:loads")
+# The s code will cause a Unicode conversion to occur. This test
+# verify that the error is propagated properly from the C code back to
+# Python.
+
+# XXX If the encoding succeeds using the current default encoding,
+# this test will fail because it does not test the right part of the
+# PyArg_ParseTuple() implementation.
+from test.test_support import have_unicode
+import marshal
+
+if have_unicode:
+ try:
+ marshal.loads(unicode(r"\222", 'unicode-escape'))
+ except UnicodeError:
+ pass