File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -211,10 +211,23 @@ test_py_set_immortal(PyObject *self, PyObject *unused)
211211 Py_SET_REFCNT (& object , 1 );
212212 Py_SET_TYPE (& object , & PyBaseObject_Type );
213213 assert (!PyUnstable_IsImmortal (& object ));
214- PyUnstable_SetImmortal (& object );
214+ int rc = PyUnstable_SetImmortal (& object );
215+ assert (rc == 1 );
215216 assert (PyUnstable_IsImmortal (& object ));
216217 Py_DECREF (& object ); // should not dealloc
217218 assert (PyUnstable_IsImmortal (& object ));
219+
220+ // Check already immortal object
221+ rc = PyUnstable_SetImmortal (& object );
222+ assert (rc == 0 );
223+
224+ // Check unicode objects
225+ PyObject * unicode = PyUnicode_FromString ("test" );
226+ assert (!PyUnstable_IsImmortal (unicode ));
227+ rc = PyUnstable_SetImmortal (unicode );
228+ assert (rc == 0 );
229+ assert (!PyUnstable_IsImmortal (unicode ));
230+ Py_DECREF (unicode );
218231 Py_RETURN_NONE ;
219232}
220233
You can’t perform that action at this time.
0 commit comments