diff --git a/tests/misc/recursive_iternext.py b/tests/misc/recursive_iternext.py
new file mode 100644
index 0000000000000000000000000000000000000000..ac3a17e93b1bb901e83c70386d7942eac1caf3c3
--- /dev/null
+++ b/tests/misc/recursive_iternext.py
@@ -0,0 +1,33 @@
+# This tests that recursion with iternext doesn't lead to segfault.
+
+try:
+    x = (1, 2)
+    for i in range(1000):
+        x = enumerate(x)
+    tuple(x)
+except RuntimeError:
+    print("RuntimeError")
+
+try:
+    x = (1, 2)
+    for i in range(1000):
+        x = filter(None, x)
+    tuple(x)
+except RuntimeError:
+    print("RuntimeError")
+
+try:
+    x = (1, 2)
+    for i in range(1000):
+        x = map(max, x, ())
+    tuple(x)
+except RuntimeError:
+    print("RuntimeError")
+
+try:
+    x = (1, 2)
+    for i in range(1000):
+        x = zip(x)
+    tuple(x)
+except RuntimeError:
+    print("RuntimeError")
diff --git a/tests/misc/recursive_iternext.py.exp b/tests/misc/recursive_iternext.py.exp
new file mode 100644
index 0000000000000000000000000000000000000000..80d1488a3795f2d3438efa05e6626d77dac80802
--- /dev/null
+++ b/tests/misc/recursive_iternext.py.exp
@@ -0,0 +1,4 @@
+RuntimeError
+RuntimeError
+RuntimeError
+RuntimeError