diff -r 1f94fec31265 Lib/warnings.py
--- a/Lib/warnings.py Wed Aug 26 14:10:32 2015 -0400
+++ b/Lib/warnings.py Wed Aug 26 12:48:23 2015 -0700
@@ -369,12 +369,13 @@
# If either if the compiled regexs are None, match anything.
_warnings_defaults = False
try:
- from _warnings import (filters, _defaultaction, _onceregistry,
+ if __name__ == '_frozen_warnings':
+ raise ImportError
+ from _frozen_warnings import (filters, _defaultaction, _onceregistry,
warn, warn_explicit, _filters_mutated)
defaultaction = _defaultaction
onceregistry = _onceregistry
_warnings_defaults = True
-
except ImportError:
filters = []
defaultaction = "default"
diff -r 1f94fec31265 Makefile.pre.in
--- a/Makefile.pre.in Wed Aug 26 14:10:32 2015 -0400
+++ b/Makefile.pre.in Wed Aug 26 12:48:23 2015 -0700
@@ -704,6 +704,10 @@
./Programs/_freeze_importlib \
$(srcdir)/Lib/importlib/_bootstrap.py Python/importlib.h
+Python/warnings.h: $(srcdir)/Lib/warnings.py Programs/_freeze_importlib
+ ./Programs/_freeze_importlib \
+ $(srcdir)/Lib/warnings.py Python/warnings.h
+
############################################################################
# Special rules for object files
@@ -847,7 +851,7 @@
Python/ceval.o: $(OPCODETARGETS_H) $(srcdir)/Python/ceval_gil.h
-Python/frozen.o: Python/importlib.h Python/importlib_external.h
+Python/frozen.o: Python/importlib.h Python/importlib_external.h Python/warnings.h
Objects/typeobject.o: Objects/typeslots.inc
Objects/typeslots.inc: $(srcdir)/Include/typeslots.h $(srcdir)/Objects/typeslots.py
diff -r 1f94fec31265 Programs/_freeze_importlib.c
--- a/Programs/_freeze_importlib.c Wed Aug 26 14:10:32 2015 -0400
+++ b/Programs/_freeze_importlib.c Wed Aug 26 12:48:23 2015 -0700
@@ -40,6 +40,7 @@
unsigned char *data;
PyObject *code = NULL, *marshalled = NULL;
int is_bootstrap = 1;
+ int is_importlib = 0;
PyImport_FrozenModules = _PyImport_FrozenModules;
@@ -82,13 +83,21 @@
/* Don't install importlib, since it could execute outdated bytecode. */
_Py_InitializeEx_Private(1, 0);
- if (strstr(inpath, "_external") != NULL) {
- is_bootstrap = 0;
+ if (strstr(inpath, "importlib") != NULL) {
+ is_importlib = 1;
+ if (strstr(inpath, "_external") != NULL) {
+ is_bootstrap = 0;
+ }
}
- code_name = is_bootstrap ?
- "