``F_SEAL_*`` constants for sealing of :func:`os.memfd_create` file
descriptors.
+.. versionchanged:: 3.9
+ On macOS, the fcntl module exposes the ``F_GETPATH`` constant, which obtains
+ the path of a file from a file descriptor.
+
The module defines the following functions:
self.assertRaises(OverflowError, fcntl.flock, _testcapi.INT_MAX+1,
fcntl.LOCK_SH)
+ @unittest.skipIf(sys.platform != 'darwin', "F_GETPATH is only available on macos")
+ def test_fcntl_f_getpath(self):
+ self.f = open(TESTFN, 'wb')
+ abspath = os.path.abspath(TESTFN)
+ res = fcntl.fcntl(self.f.fileno(), fcntl.F_GETPATH, bytes(len(abspath)))
+ self.assertEqual(abspath, res.decode('utf-8'))
def test_main():
run_unittest(TestFcntl)
#ifdef F_SETOWN
if (PyModule_AddIntMacro(m, F_SETOWN)) return -1;
#endif
+#ifdef F_GETPATH
+ if (PyModule_AddIntMacro(m, F_GETPATH)) return -1;
+#endif
#ifdef F_GETSIG
if (PyModule_AddIntMacro(m, F_GETSIG)) return -1;
#endif