summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/codecs.c9
-rw-r--r--Python/graminit.c30
-rw-r--r--Python/import.c25
-rw-r--r--Python/pythonrun.c3
-rw-r--r--Python/sysmodule.c2
5 files changed, 31 insertions, 38 deletions
diff --git a/Python/codecs.c b/Python/codecs.c
index 1a3e457..c7f4a9c 100644
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -1067,15 +1067,6 @@ static int _PyCodecRegistry_Init(void)
mod = PyImport_ImportModuleNoBlock("encodings");
if (mod == NULL) {
- if (PyErr_ExceptionMatches(PyExc_ImportError)) {
- /* Ignore ImportErrors... this is done so that
- distributions can disable the encodings package. Note
- that other errors are not masked, e.g. SystemErrors
- raised to inform the user of an error in the Python
- configuration are still reported back to the user. */
- PyErr_Clear();
- return 0;
- }
return -1;
}
Py_DECREF(mod);
diff --git a/Python/graminit.c b/Python/graminit.c
index a8af583..cabc4d6 100644
--- a/Python/graminit.c
+++ b/Python/graminit.c
@@ -1978,7 +1978,7 @@ static label labels[168] = {
{258, 0},
{327, 0},
{259, 0},
- {50, 0},
+ {49, 0},
{289, 0},
{7, 0},
{330, 0},
@@ -1990,7 +1990,7 @@ static label labels[168] = {
{1, "def"},
{1, 0},
{263, 0},
- {51, 0},
+ {50, 0},
{302, 0},
{11, 0},
{301, 0},
@@ -1999,7 +1999,7 @@ static label labels[168] = {
{22, 0},
{12, 0},
{16, 0},
- {36, 0},
+ {35, 0},
{266, 0},
{267, 0},
{270, 0},
@@ -2016,6 +2016,7 @@ static label labels[168] = {
{273, 0},
{336, 0},
{311, 0},
+ {36, 0},
{37, 0},
{38, 0},
{39, 0},
@@ -2026,8 +2027,7 @@ static label labels[168] = {
{44, 0},
{45, 0},
{46, 0},
- {47, 0},
- {49, 0},
+ {48, 0},
{1, "del"},
{326, 0},
{1, "pass"},
@@ -2046,7 +2046,7 @@ static label labels[168] = {
{1, "import"},
{288, 0},
{23, 0},
- {52, 0},
+ {51, 0},
{287, 0},
{285, 0},
{1, "as"},
@@ -2088,38 +2088,38 @@ static label labels[168] = {
{310, 0},
{20, 0},
{21, 0},
- {28, 0},
- {31, 0},
+ {27, 0},
{30, 0},
{29, 0},
- {29, 0},
+ {28, 0},
+ {28, 0},
{1, "is"},
{313, 0},
{18, 0},
{314, 0},
- {33, 0},
+ {32, 0},
{315, 0},
{19, 0},
{316, 0},
+ {33, 0},
{34, 0},
- {35, 0},
{317, 0},
{14, 0},
{15, 0},
{318, 0},
{17, 0},
{24, 0},
- {48, 0},
- {32, 0},
+ {47, 0},
+ {31, 0},
{319, 0},
{320, 0},
{322, 0},
{321, 0},
{9, 0},
{10, 0},
- {26, 0},
+ {25, 0},
{328, 0},
- {27, 0},
+ {26, 0},
{2, 0},
{3, 0},
{1, "None"},
diff --git a/Python/import.c b/Python/import.c
index e721498..beda7f97 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -1226,9 +1226,9 @@ write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat)
(void) unlink(cpathname);
return;
}
- /* Now write the true mtime */
+ /* Now write the true mtime (as a 32-bit field) */
fseek(fp, 4L, 0);
- assert(mtime < LONG_MAX);
+ assert(mtime <= 0xFFFFFFFF);
PyMarshal_WriteLongToFile((long)mtime, fp, Py_MARSHAL_VERSION);
fflush(fp);
fclose(fp);
@@ -1302,17 +1302,14 @@ load_source_module(char *name, char *pathname, FILE *fp)
pathname);
return NULL;
}
-#if SIZEOF_TIME_T > 4
- /* Python's .pyc timestamp handling presumes that the timestamp fits
- in 4 bytes. This will be fine until sometime in the year 2038,
- when a 4-byte signed time_t will overflow.
- */
- if (st.st_mtime >> 32) {
- PyErr_SetString(PyExc_OverflowError,
- "modification time overflows a 4 byte field");
- return NULL;
+ if (sizeof st.st_mtime > 4) {
+ /* Python's .pyc timestamp handling presumes that the timestamp fits
+ in 4 bytes. Since the code only does an equality comparison,
+ ordering is not important and we can safely ignore the higher bits
+ (collisions are extremely unlikely).
+ */
+ st.st_mtime &= 0xFFFFFFFF;
}
-#endif
cpathname = make_compiled_pathname(
pathname, buf, (size_t)MAXPATHLEN + 1, !Py_OptimizeFlag);
if (cpathname != NULL &&
@@ -2169,6 +2166,7 @@ init_builtin(char *name)
for (p = PyImport_Inittab; p->name != NULL; p++) {
PyObject *mod;
+ PyModuleDef *def;
if (strcmp(name, p->name) == 0) {
if (p->initfunc == NULL) {
PyErr_Format(PyExc_ImportError,
@@ -2181,6 +2179,9 @@ init_builtin(char *name)
mod = (*p->initfunc)();
if (mod == 0)
return -1;
+ /* Remember pointer to module init function. */
+ def = PyModule_GetDef(mod);
+ def->m_base.m_init = p->initfunc;
if (_PyImport_FixupBuiltin(mod, name) < 0)
return -1;
/* FixupExtension has put the module into sys.modules,
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 4b0ac13..ec69bcb 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1012,7 +1012,8 @@ initstdio(void)
const char * encoding;
encoding = _PyUnicode_AsString(encoding_attr);
if (encoding != NULL) {
- _PyCodec_Lookup(encoding);
+ PyObject *codec_info = _PyCodec_Lookup(encoding);
+ Py_XDECREF(codec_info);
}
Py_DECREF(encoding_attr);
}
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 73dc0dd..8a659c5 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1263,7 +1263,7 @@ version_info -- version information as a named tuple\n\
hexversion -- version information encoded as a single integer\n\
copyright -- copyright notice pertaining to this interpreter\n\
platform -- platform identifier\n\
-executable -- pathname of this Python interpreter\n\
+executable -- absolute path of the executable binary of the Python interpreter\n\
prefix -- prefix used to find the Python library\n\
exec_prefix -- prefix used to find the machine-specific Python library\n\
float_repr_style -- string indicating the style of repr() output for floats\n\