summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-10-18 18:49:37 (GMT)
committerGuido van Rossum <guido@python.org>2001-10-18 18:49:37 (GMT)
commit4114a4afecdf1753b1140059d71bb03b4cec3ef1 (patch)
tree0037455420bbddb0611fccc450b1a7f24e16838a /Lib/test
parent9ae09947f4c62bf1fffa9091b4ddc8833d5bcdfe (diff)
downloadcpython-4114a4afecdf1753b1140059d71bb03b4cec3ef1.zip
cpython-4114a4afecdf1753b1140059d71bb03b4cec3ef1.tar.gz
cpython-4114a4afecdf1753b1140059d71bb03b4cec3ef1.tar.bz2
Fix the frozen bytecode for __hello__ (betcha didn't know that existed
:-). Add a test that prevents the __hello__ bytecode from going stale unnoticed again. The test also tests the loophole noted in SF bug #404545. This test will fail right now; I'll check in the fix in a minute.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/output/test_frozen4
-rw-r--r--Lib/test/test_frozen.py26
2 files changed, 30 insertions, 0 deletions
diff --git a/Lib/test/output/test_frozen b/Lib/test/output/test_frozen
new file mode 100644
index 0000000..76f17db
--- /dev/null
+++ b/Lib/test/output/test_frozen
@@ -0,0 +1,4 @@
+test_frozen
+Hello world...
+Hello world...
+Hello world...
diff --git a/Lib/test/test_frozen.py b/Lib/test/test_frozen.py
new file mode 100644
index 0000000..3aa91ab
--- /dev/null
+++ b/Lib/test/test_frozen.py
@@ -0,0 +1,26 @@
+# Test the frozen module defined in frozen.c.
+
+from test_support import TestFailed
+import sys, os
+
+try:
+ import __hello__
+except ImportError, x:
+ raise TestFailed, "import __hello__ failed:", x
+
+try:
+ import __phello__
+except ImportError, x:
+ raise TestFailed, "import __phello__ failed:", x
+
+try:
+ import __phello__.spam
+except ImportError, x:
+ raise TestFailed, "import __phello__.spam failed:", x
+
+try:
+ import __phello__.foo
+except ImportError:
+ pass
+else:
+ raise TestFailed, "import __phello__.foo should have failed"