summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-02-23 18:30:17 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-02-23 18:30:17 (GMT)
commit05e8be17fd15d8e649e026600f5ab20e1154599f (patch)
treeaecf3cd024e9cf2ed2ae49087b6c74dba29c7c7e /Python
parent5abe9125f9eb858fdaca966d687bb32387603f45 (diff)
downloadcpython-05e8be17fd15d8e649e026600f5ab20e1154599f.zip
cpython-05e8be17fd15d8e649e026600f5ab20e1154599f.tar.gz
cpython-05e8be17fd15d8e649e026600f5ab20e1154599f.tar.bz2
Merged revisions 60990-61002 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r60990 | eric.smith | 2008-02-23 17:05:26 +0100 (Sat, 23 Feb 2008) | 1 line Removed duplicate Py_CHARMASK define. It's already defined in Python.h. ........ r60991 | andrew.kuchling | 2008-02-23 17:23:05 +0100 (Sat, 23 Feb 2008) | 4 lines #1330538: Improve comparison of xmlrpclib.DateTime and datetime instances. Remove automatic handling of datetime.date and datetime.time. This breaks backward compatibility, but python-dev discussion was strongly against this automatic conversion; see the bug for a link. ........ r60994 | andrew.kuchling | 2008-02-23 17:39:43 +0100 (Sat, 23 Feb 2008) | 1 line #835521: Add index entries for various pickle-protocol methods and attributes ........ r60995 | andrew.kuchling | 2008-02-23 18:10:46 +0100 (Sat, 23 Feb 2008) | 2 lines #1433694: minidom's .normalize() failed to set .nextSibling for last element. Fix by Malte Helmert ........ r61000 | christian.heimes | 2008-02-23 18:40:11 +0100 (Sat, 23 Feb 2008) | 1 line Patch #2167 from calvin: Remove unused imports ........ r61001 | christian.heimes | 2008-02-23 18:42:31 +0100 (Sat, 23 Feb 2008) | 1 line Patch #1957: syslogmodule: Release GIL when calling syslog(3) ........ r61002 | christian.heimes | 2008-02-23 18:52:07 +0100 (Sat, 23 Feb 2008) | 2 lines Issue #2051 and patch from Alexander Belopolsky: Permission for pyc and pyo files are inherited from the py file. ........
Diffstat (limited to 'Python')
-rw-r--r--Python/Python-ast.c4
-rw-r--r--Python/import.c27
-rw-r--r--Python/mystrtoul.c8
3 files changed, 16 insertions, 23 deletions
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index c46176c..fc970d8 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -2,7 +2,7 @@
/*
- __version__ 57783.
+ __version__ 60978.
This module must be committed separately after each AST grammar change;
The __version__ number is set to the revision number of the commit
@@ -3171,7 +3171,7 @@ init_ast(void)
if (PyDict_SetItemString(d, "AST", (PyObject*)AST_type) < 0) return;
if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0)
return;
- if (PyModule_AddStringConstant(m, "__version__", "57783") < 0)
+ if (PyModule_AddStringConstant(m, "__version__", "60978") < 0)
return;
if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return;
if (PyDict_SetItemString(d, "Module", (PyObject*)Module_type) < 0)
diff --git a/Python/import.c b/Python/import.c
index 77fe168..22fc4ac 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -833,7 +833,7 @@ parse_source_module(const char *pathname, FILE *fp)
/* Helper to open a bytecode file for writing in exclusive mode */
static FILE *
-open_exclusive(char *filename)
+open_exclusive(char *filename, mode_t mode)
{
#if defined(O_EXCL)&&defined(O_CREAT)&&defined(O_WRONLY)&&defined(O_TRUNC)
/* Use O_EXCL to avoid a race condition when another process tries to
@@ -849,9 +849,9 @@ open_exclusive(char *filename)
|O_BINARY /* necessary for Windows */
#endif
#ifdef __VMS
- , 0666, "ctxt=bin", "shr=nil"
+ , mode, "ctxt=bin", "shr=nil"
#else
- , 0666
+ , mode
#endif
);
if (fd < 0)
@@ -870,11 +870,13 @@ open_exclusive(char *filename)
remove the file. */
static void
-write_compiled_module(PyCodeObject *co, char *cpathname, time_t mtime)
+write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat)
{
FILE *fp;
+ time_t mtime = srcstat->st_mtime;
+ mode_t mode = srcstat->st_mode;
- fp = open_exclusive(cpathname);
+ fp = open_exclusive(cpathname, mode);
if (fp == NULL) {
if (Py_VerboseFlag)
PySys_WriteStderr(
@@ -911,17 +913,16 @@ write_compiled_module(PyCodeObject *co, char *cpathname, time_t mtime)
static PyObject *
load_source_module(char *name, char *pathname, FILE *fp)
{
- time_t mtime;
+ struct stat st;
FILE *fpc;
char buf[MAXPATHLEN+1];
char *cpathname;
PyCodeObject *co;
PyObject *m;
-
- mtime = PyOS_GetLastModificationTime(pathname, fp);
- if (mtime == (time_t)(-1)) {
+
+ if (fstat(fileno(fp), &st) != 0) {
PyErr_Format(PyExc_RuntimeError,
- "unable to get modification time from '%s'",
+ "unable to get file status from '%s'",
pathname);
return NULL;
}
@@ -930,7 +931,7 @@ load_source_module(char *name, char *pathname, FILE *fp)
in 4 bytes. This will be fine until sometime in the year 2038,
when a 4-byte signed time_t will overflow.
*/
- if (mtime >> 32) {
+ if (st.st_mtime >> 32) {
PyErr_SetString(PyExc_OverflowError,
"modification time overflows a 4 byte field");
return NULL;
@@ -939,7 +940,7 @@ load_source_module(char *name, char *pathname, FILE *fp)
cpathname = make_compiled_pathname(pathname, buf,
(size_t)MAXPATHLEN + 1);
if (cpathname != NULL &&
- (fpc = check_compiled_module(pathname, mtime, cpathname))) {
+ (fpc = check_compiled_module(pathname, st.st_mtime, cpathname))) {
co = read_compiled_module(cpathname, fpc);
fclose(fpc);
if (co == NULL)
@@ -959,7 +960,7 @@ load_source_module(char *name, char *pathname, FILE *fp)
if (cpathname) {
PyObject *ro = PySys_GetObject("dont_write_bytecode");
if (ro == NULL || !PyObject_IsTrue(ro))
- write_compiled_module(co, cpathname, mtime);
+ write_compiled_module(co, cpathname, &st);
}
}
m = PyImport_ExecCodeModuleEx(name, (PyObject *)co, pathname);
diff --git a/Python/mystrtoul.c b/Python/mystrtoul.c
index c26111a..347f361 100644
--- a/Python/mystrtoul.c
+++ b/Python/mystrtoul.c
@@ -5,14 +5,6 @@
#define _SGI_MP_SOURCE
#endif
-/* Convert a possibly signed character to a nonnegative int */
-/* XXX This assumes characters are 8 bits wide */
-#ifdef __CHAR_UNSIGNED__
-#define Py_CHARMASK(c) (c)
-#else
-#define Py_CHARMASK(c) ((c) & 0xff)
-#endif
-
/* strtol and strtoul, renamed to avoid conflicts */