Commits

Kyle Ambroff committed e536bee

#21 - Can't pass parent=None to greenlet.greenlet()

Check that the parent argument is not NULL or Py_None in green_init().

C API works as expected, no change necessary.

  • Participants
  • Parent commits 7a82658

Comments (0)

Files changed (2)

 		if (green_setrun(self, run, NULL))
 			return -1;
 	}
-	if (nparent != NULL)
+	if (nparent != NULL && nparent != Py_None)
 		return green_setparent(self, nparent, NULL);
 	return 0;
 }

File tests/test_greenlet.py

         lst.append(4)
         self.assertEquals(lst, list(range(5)))
 
+    def test_parent_equals_None(self):
+        g = greenlet(parent=None)
+
+    def test_run_equals_None(self):
+        g = greenlet(run=None)
+
     def test_threads(self):
         success = []
         def f():