Fix an issue where os.posix_spawn() would incorrectly raise a TypeError
when file_actions is None.
with open(envfile) as f:
self.assertEqual(f.read(), 'bar')
+ def test_none_file_actions(self):
+ pid = self.spawn_func(
+ self.NOOP_PROGRAM[0],
+ self.NOOP_PROGRAM,
+ os.environ,
+ file_actions=None
+ )
+ self.assertEqual(os.waitpid(pid, 0), (pid, 0))
+
def test_empty_file_actions(self):
pid = self.spawn_func(
self.NOOP_PROGRAM[0],
--- /dev/null
+Fix an issue where os.posix_spawnp() would incorrectly raise a TypeError when file_actions is None.
\ No newline at end of file
goto exit;
}
- if (file_actions != NULL) {
+ if (file_actions != NULL && file_actions != Py_None) {
/* There is a bug in old versions of glibc that makes some of the
* helper functions for manipulating file actions not copy the provided
* buffers. The problem is that posix_spawn_file_actions_addopen does not