From 8ac72b9d000ecc48a2d558bdb7c73c7f98d4be62 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky <pfalcon@users.sourceforge.net>
Date: Sat, 15 Feb 2014 12:28:24 +0200
Subject: [PATCH] Add testcase for failing namespace switch throwing exception
 from a module.

Issue #290. This currently fails, to draw attention to the issue.
---
 tests/basics/import1b.py   |  3 +++
 tests/basics/try-module.py | 15 +++++++++++++++
 2 files changed, 18 insertions(+)
 create mode 100644 tests/basics/try-module.py

diff --git a/tests/basics/import1b.py b/tests/basics/import1b.py
index 80479088f..be74eca09 100644
--- a/tests/basics/import1b.py
+++ b/tests/basics/import1b.py
@@ -1 +1,4 @@
 var = 123
+
+def throw():
+    raise ValueError
diff --git a/tests/basics/try-module.py b/tests/basics/try-module.py
new file mode 100644
index 000000000..e62df8487
--- /dev/null
+++ b/tests/basics/try-module.py
@@ -0,0 +1,15 @@
+# Regression test for #290 - throwing exception in another module led to
+# its namespace stick and namespace of current module not coming back.
+import import1b
+
+def func1():
+    return
+
+def func2():
+    try:
+        import1b.throw()
+    except ValueError:
+        pass
+    func1()
+
+func2()
-- 
GitLab