Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Checkins

cpython: capitialize utime statuses

 

 

Python checkins RSS feed   Index | Next | Previous | View Threaded


python-checkins at python

May 25, 2012, 10:26 AM

Post #1 of 1 (72 views)
Permalink
cpython: capitialize utime statuses

http://hg.python.org/cpython/rev/789469caffe5
changeset: 77145:789469caffe5
user: Benjamin Peterson <benjamin [at] python>
date: Fri May 25 10:26:47 2012 -0700
summary:
capitialize utime statuses

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


diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -3661,11 +3661,11 @@
*/

typedef enum {
- utime_success = 0,
- utime_parse_failure = 1,
- utime_times_and_ns_collision = 2,
- utime_times_conversion_failure = 3,
- utime_ns_conversion_failure = 4,
+ UTIME_SUCCESS = 0,
+ UTIME_PARSE_FAILURE = 1,
+ UTIME_TIMES_AND_NS_COLLISION = 2,
+ UTIME_TIMES_CONVERSION_FAILURE = 3,
+ UTIME_NS_CONVERSION_FAILURE = 4,
} utime_status;

static utime_status
@@ -3697,14 +3697,14 @@
format, kwlist, ua->path, &times, &ns);

if (!parse_result)
- return utime_parse_failure;
+ return UTIME_PARSE_FAILURE;

if (times && ns) {
PyErr_Format(PyExc_RuntimeError,
"%s: you may specify either 'times'"
" or 'ns' but not both",
ua->function_name);
- return_value = utime_times_and_ns_collision;
+ return_value = UTIME_TIMES_AND_NS_COLLISION;
goto fail;
}

@@ -3714,7 +3714,7 @@
"%s: 'times' must be either"
" a tuple of two ints or None",
ua->function_name);
- return_value = utime_times_conversion_failure;
+ return_value = UTIME_TIMES_CONVERSION_FAILURE;
goto fail;
}
ua->now = 0;
@@ -3722,10 +3722,10 @@
&ua->atime_s, &ua->atime_ns) == -1 ||
_PyTime_ObjectToTimespec(PyTuple_GET_ITEM(times, 1),
&ua->mtime_s, &ua->mtime_ns) == -1) {
- return_value = utime_times_conversion_failure;
+ return_value = UTIME_TIMES_CONVERSION_FAILURE;
goto fail;
}
- return utime_success;
+ return UTIME_SUCCESS;
}

if (ns) {
@@ -3733,7 +3733,7 @@
PyErr_Format(PyExc_TypeError,
"%s: 'ns' must be a tuple of two ints",
ua->function_name);
- return_value = utime_ns_conversion_failure;
+ return_value = UTIME_NS_CONVERSION_FAILURE;
goto fail;
}
ua->now = 0;
@@ -3741,15 +3741,15 @@
&ua->atime_s, &ua->atime_ns) ||
!split_py_long_to_s_and_ns(PyTuple_GET_ITEM(ns, 1),
&ua->mtime_s, &ua->mtime_ns)) {
- return_value = utime_ns_conversion_failure;
+ return_value = UTIME_NS_CONVERSION_FAILURE;
goto fail;
}
- return utime_success;
+ return UTIME_SUCCESS;
}

/* either times=None, or neither times nor ns was specified. use "now". */
ua->now = 1;
- return utime_success;
+ return UTIME_SUCCESS;

fail:
if (ua->converter)
@@ -3786,7 +3786,7 @@
switch (utime_read_time_arguments(&ua)) {
default:
return NULL;
- case utime_success: {
+ case UTIME_SUCCESS: {
wchar_t *wpath = PyUnicode_AsUnicode(upath);
if (wpath == NULL)
return NULL;
@@ -3799,7 +3799,7 @@
return win32_error_object("utime", upath);
break;
}
- case utime_parse_failure: {
+ case UTIME_PARSE_FAILURE: {
const char *apath;
/* Drop the argument parsing error as narrow strings
are also valid. */
@@ -3807,7 +3807,7 @@

ua.path_format = 'y';
ua.path = (PyObject **)&apath;
- if (utime_read_time_arguments(&ua) != utime_success)
+ if (utime_read_time_arguments(&ua) != UTIME_SUCCESS)
return NULL;
if (win32_warn_bytes_api())
return NULL;
@@ -3862,7 +3862,7 @@
ua.path = &opath;
ua.converter = PyUnicode_FSConverter;

- if (utime_read_time_arguments(&ua) != utime_success)
+ if (utime_read_time_arguments(&ua) != UTIME_SUCCESS)
return NULL;
path = PyBytes_AsString(opath);
if (ua.now) {
@@ -3915,7 +3915,7 @@
ua.path = (PyObject **)&fd;
ua.first_argument_name = "fd";

- if (utime_read_time_arguments(&ua) != utime_success)
+ if (utime_read_time_arguments(&ua) != UTIME_SUCCESS)
return NULL;

if (ua.now) {
@@ -3960,7 +3960,7 @@
ua.path = &opath;
ua.converter = PyUnicode_FSConverter;

- if (utime_read_time_arguments(&ua) != utime_success)
+ if (utime_read_time_arguments(&ua) != UTIME_SUCCESS)
return NULL;
path = PyBytes_AsString(opath);


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

Python checkins RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.