Index: pyconfig.h.in
===================================================================
--- pyconfig.h.in	(Revision 59223)
+++ pyconfig.h.in	(Arbeitskopie)
@@ -144,6 +144,12 @@
 /* Define if you have the 'fchdir' function. */
 #undef HAVE_FCHDIR
 
+/* Define if you have the 'fchmod' function. */
+#undef HAVE_FCHMOD
+
+/* Define if you have the 'fchown' function. */
+#undef HAVE_FCHOWN
+
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
Index: configure
===================================================================
--- configure	(Revision 59223)
+++ configure	(Arbeitskopie)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 58653 .
+# From configure.in Revision: 58784 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61 for python 2.6.
 #
@@ -15226,8 +15226,10 @@
 
 
 
+
+
 for ac_func in alarm bind_textdomain_codeset chflags chown clock confstr \
- ctermid execv fork fpathconf ftime ftruncate \
+ ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
  gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
  getpriority getpwent getspnam getspent getsid getwd \
  kill killpg lchflags lchown lstat mkfifo mknod mktime \
Index: configure.in
===================================================================
--- configure.in	(Revision 59223)
+++ configure.in	(Arbeitskopie)
@@ -2304,7 +2304,7 @@
 
 # checks for library functions
 AC_CHECK_FUNCS(alarm bind_textdomain_codeset chflags chown clock confstr \
- ctermid execv fork fpathconf ftime ftruncate \
+ ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
  gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
  getpriority getpwent getspnam getspent getsid getwd \
  kill killpg lchflags lchown lstat mkfifo mknod mktime \
Index: Modules/posixmodule.c
===================================================================
--- Modules/posixmodule.c	(Revision 59223)
+++ Modules/posixmodule.c	(Arbeitskopie)
@@ -191,6 +191,9 @@
 #else
 extern int chmod(const char *, mode_t);
 #endif
+/*#ifdef HAVE_FCHMOD
+extern int fchmod(int, mode_t);
+#endif*/
 extern int chown(const char *, uid_t, gid_t);
 extern char *getcwd(char *, int);
 extern char *strerror(int);
@@ -1722,7 +1725,28 @@
 #endif
 }
 
+#ifdef HAVE_FCHMOD
+PyDoc_STRVAR(posix_fchmod__doc__,
+"fchmod(fd, mode)\n\n\
+Change the access permissions of the file given by file\n\
+descriptor fd.");
 
+static PyObject *
+posix_fchmod(PyObject *self, PyObject *args)
+{
+	int fd, mode, res;
+	if (!PyArg_ParseTuple(args, "ii:fchmod", &fd, &mode))
+		return NULL;
+	Py_BEGIN_ALLOW_THREADS
+	res = fchmod(fd, mode);
+	Py_END_ALLOW_THREADS
+	if (res < 0)
+		return posix_error();
+	Py_RETURN_NONE;
+}
+#endif /* HAVE_FCHMOD */
+
+
 #ifdef HAVE_CHFLAGS
 PyDoc_STRVAR(posix_chflags__doc__,
 "chflags(path, flags)\n\n\
@@ -1843,6 +1867,28 @@
 }
 #endif /* HAVE_CHOWN */
 
+#ifdef HAVE_FCHOWN
+PyDoc_STRVAR(posix_fchown__doc__,
+"fchown(fd, uid, gid)\n\n\
+Change the owner and group id of the file given by file descriptor\n\
+fd to the numeric uid and gid.");
+
+static PyObject *
+posix_fchown(PyObject *self, PyObject *args)
+{
+	int fd, uid, gid;
+	int res;
+	if (!PyArg_ParseTuple(args, "iii:chown", &fd, &uid, &gid))
+		return NULL;
+	Py_BEGIN_ALLOW_THREADS
+	res = fchown(fd, (uid_t) uid, (gid_t) gid);
+	Py_END_ALLOW_THREADS
+	if (res < 0)
+		return posix_error();
+	Py_RETURN_NONE;
+}
+#endif /* HAVE_FCHOWN */
+
 #ifdef HAVE_LCHOWN
 PyDoc_STRVAR(posix_lchown__doc__,
 "lchown(path, uid, gid)\n\n\
@@ -8182,9 +8228,15 @@
 	{"chflags",	posix_chflags, METH_VARARGS, posix_chflags__doc__},
 #endif /* HAVE_CHFLAGS */
 	{"chmod",	posix_chmod, METH_VARARGS, posix_chmod__doc__},
+#ifdef HAVE_FCHMOD
+	{"fchmod",	posix_fchmod, METH_VARARGS, posix_fchmod__doc__},
+#endif /* HAVE_FCHMOD */
 #ifdef HAVE_CHOWN
 	{"chown",	posix_chown, METH_VARARGS, posix_chown__doc__},
 #endif /* HAVE_CHOWN */
+#ifdef HAVE_FCHOWN
+	{"fchown",	posix_fchown, METH_VARARGS, posix_fchown__doc__},
+#endif /* HAVE_FCHOWN */
 #ifdef HAVE_LCHFLAGS
 	{"lchflags",	posix_lchflags, METH_VARARGS, posix_lchflags__doc__},
 #endif /* HAVE_LCHFLAGS */
Index: Doc/library/os.rst
===================================================================
--- Doc/library/os.rst	(Revision 59223)
+++ Doc/library/os.rst	(Arbeitskopie)
@@ -523,6 +523,19 @@
    Availability: Macintosh, Unix, Windows.
 
 
+.. function:: fchmod(fd, mode)
+
+   Change the mode of the file given by *fd* to the numeric *mode*.  See the docs
+   for :func:`chmod` for possible values of *mode*.  Availability: Unix.
+
+
+.. function:: fchown(fd, uid, gid)
+
+   Change the owner and group id of the file given by *fd* to the numeric *uid*
+   and *gid*.  To leave one of the ids unchanged, set it to -1.
+   Availability: Unix.
+
+
 .. function:: fdatasync(fd)
 
    Force write of file with filedescriptor *fd* to disk. Does not force update of
