[Python-checkins] cpython (3.2): posixmodule.c: fix function name in argument parsing

victor.stinner python-checkins at python.org
Fri Jun 17 15:18:14 CEST 2011


http://hg.python.org/cpython/rev/f6d6afe53385
changeset:   70840:f6d6afe53385
branch:      3.2
parent:      70838:ca18f7f35c28
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Fri Jun 17 15:15:38 2011 +0200
summary:
  posixmodule.c: fix function name in argument parsing

Fix os.fchown() and os.open()

Remove also trailing spaces and replace tabs by spaces.

files:
  Modules/posixmodule.c |  44 +++++++++++++++---------------
  1 files changed, 22 insertions(+), 22 deletions(-)


diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -121,7 +121,7 @@
 #ifdef _MSC_VER         /* Microsoft compiler */
 #define HAVE_GETCWD     1
 #define HAVE_GETPPID    1
-#define HAVE_GETLOGIN   1 
+#define HAVE_GETLOGIN   1
 #define HAVE_SPAWNV     1
 #define HAVE_EXECV      1
 #define HAVE_PIPE       1
@@ -1133,11 +1133,11 @@
 win32_xstat_impl(const char *path, struct win32_stat *result,
                  BOOL traverse)
 {
-    int code; 
+    int code;
     HANDLE hFile, hFile2;
     BY_HANDLE_FILE_INFORMATION info;
     ULONG reparse_tag = 0;
-	wchar_t *target_path;
+    wchar_t *target_path;
     const char *dot;
 
     if(!check_GetFinalPathNameByHandle()) {
@@ -1233,7 +1233,7 @@
     HANDLE hFile, hFile2;
     BY_HANDLE_FILE_INFORMATION info;
     ULONG reparse_tag = 0;
-	wchar_t *target_path;
+    wchar_t *target_path;
     const wchar_t *dot;
 
     if(!check_GetFinalPathNameByHandle()) {
@@ -1252,7 +1252,7 @@
         /* FILE_FLAG_OPEN_REPARSE_POINT does not follow the symlink.
            Because of this, calls like GetFinalPathNameByHandle will return
            the symlink path agin and not the actual final path. */
-        FILE_ATTRIBUTE_NORMAL|FILE_FLAG_BACKUP_SEMANTICS| 
+        FILE_ATTRIBUTE_NORMAL|FILE_FLAG_BACKUP_SEMANTICS|
             FILE_FLAG_OPEN_REPARSE_POINT,
         NULL);
 
@@ -1371,7 +1371,7 @@
     return win32_xstat(path, result, TRUE);
 }
 
-static int 
+static int
 win32_stat_w(const wchar_t* path, struct win32_stat *result)
 {
     return win32_xstat_w(path, result, TRUE);
@@ -2204,7 +2204,7 @@
     int fd;
     long uid, gid;
     int res;
-    if (!PyArg_ParseTuple(args, "ill:chown", &fd, &uid, &gid))
+    if (!PyArg_ParseTuple(args, "ill:fchown", &fd, &uid, &gid))
         return NULL;
     Py_BEGIN_ALLOW_THREADS
     res = fchown(fd, (uid_t) uid, (gid_t) gid);
@@ -2409,7 +2409,7 @@
     if (PyArg_ParseTuple(args, "|U:listdir", &po)) {
         WIN32_FIND_DATAW wFileData;
         Py_UNICODE *wnamebuf, *po_wchars;
-        
+
         if (po == NULL) { /* Default arg: "." */
             po_wchars = L".";
             len = 1;
@@ -2789,7 +2789,7 @@
     int result_length;
     PyObject *result;
     wchar_t *path;
-    
+
     if (!PyArg_ParseTuple(args, "u|:_getfinalpathname", &path)) {
         return NULL;
     }
@@ -2810,7 +2810,7 @@
         /* FILE_FLAG_BACKUP_SEMANTICS is required to open a directory */
         FILE_FLAG_BACKUP_SEMANTICS,
         NULL);
-    
+
     if(hFile == INVALID_HANDLE_VALUE) {
         return win32_error_unicode("GetFinalPathNamyByHandle", path);
         return PyErr_Format(PyExc_RuntimeError,
@@ -3159,7 +3159,7 @@
 
     if (GetFileAttributesExW(lpFileName, GetFileExInfoStandard, &info)) {
         is_directory = info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
-        
+
         /* Get WIN32_FIND_DATA structure for the path to determine if
            it is a symlink */
         if(is_directory &&
@@ -4349,7 +4349,7 @@
 #endif
     gid_t grouplist[MAX_GROUPS];
 
-    /* On MacOSX getgroups(2) can return more than MAX_GROUPS results 
+    /* On MacOSX getgroups(2) can return more than MAX_GROUPS results
      * This is a helper variable to store the intermediate result when
      * that happens.
      *
@@ -4565,15 +4565,15 @@
 posix_getlogin(PyObject *self, PyObject *noargs)
 {
     PyObject *result = NULL;
-#ifdef MS_WINDOWS    
+#ifdef MS_WINDOWS
     wchar_t user_name[UNLEN + 1];
     DWORD num_chars = sizeof(user_name)/sizeof(user_name[0]);
 
     if (GetUserNameW(user_name, &num_chars)) {
         /* num_chars is the number of unicode chars plus null terminator */
         result = PyUnicode_FromWideChar(user_name, num_chars - 1);
-    } 
-    else 
+    }
+    else
         result = PyErr_SetFromWindowsErr(GetLastError());
 #else
     char *name;
@@ -5257,12 +5257,12 @@
         FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS,
         0);
     Py_END_ALLOW_THREADS
-    
+
     if (reparse_point_handle==INVALID_HANDLE_VALUE)
     {
         return win32_error_unicode("readlink", path);
     }
-    
+
     Py_BEGIN_ALLOW_THREADS
     /* New call DeviceIoControl to read the reparse point */
     io_result = DeviceIoControl(
@@ -5333,7 +5333,7 @@
     int target_is_directory = 0;
     DWORD res;
     WIN32_FILE_ATTRIBUTE_DATA src_info;
-    
+
     if (!check_CreateSymbolicLinkW())
     {
         /* raise NotImplementedError */
@@ -5352,7 +5352,7 @@
         Py_DECREF(src);
         return NULL;
     }
-    
+
     /* if src is a directory, ensure target_is_directory==1 */
     if(
         GetFileAttributesExW(
@@ -5375,7 +5375,7 @@
     {
         return win32_error_unicode("symlink", PyUnicode_AsUnicode(src));
     }
-    
+
     Py_INCREF(Py_None);
     return Py_None;
 }
@@ -5573,7 +5573,7 @@
 
 #ifdef MS_WINDOWS
     PyUnicodeObject *po;
-    if (PyArg_ParseTuple(args, "Ui|i:mkdir", &po, &flag, &mode)) {
+    if (PyArg_ParseTuple(args, "Ui|i:open", &po, &flag, &mode)) {
         Py_BEGIN_ALLOW_THREADS
         /* PyUnicode_AS_UNICODE OK without thread
            lock as it is a simple dereference. */
@@ -5588,7 +5588,7 @@
     PyErr_Clear();
 #endif
 
-    if (!PyArg_ParseTuple(args, "O&i|i",
+    if (!PyArg_ParseTuple(args, "O&i|i:open",
                           PyUnicode_FSConverter, &ofile,
                           &flag, &mode))
         return NULL;

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list