[pypy-commit] pypy default: there is no need to import the full applevel warnings module to implement space.warn: warnings.warn is replaced by _warning.warn anyway, so just use that instead. As a consequence, we need to make _warnings an essential module, but I think this is fine since emitting warnings is required by some places in the core interpreter
antocuni
noreply at buildbot.pypy.org
Tue Feb 28 12:21:12 CET 2012
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch:
Changeset: r52964:538b58a51320
Date: 2012-02-28 12:17 +0100
http://bitbucket.org/pypy/pypy/changeset/538b58a51320/
Log: there is no need to import the full applevel warnings module to
implement space.warn: warnings.warn is replaced by _warning.warn
anyway, so just use that instead. As a consequence, we need to make
_warnings an essential module, but I think this is fine since
emitting warnings is required by some places in the core interpreter
diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -13,7 +13,7 @@
and not p.basename.startswith('test')]
essential_modules = dict.fromkeys(
- ["exceptions", "_file", "sys", "__builtin__", "posix"]
+ ["exceptions", "_file", "sys", "__builtin__", "posix", "_warnings"]
)
default_modules = essential_modules.copy()
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1471,8 +1471,8 @@
def warn(self, msg, w_warningcls):
self.appexec([self.wrap(msg), w_warningcls], """(msg, warningcls):
- import warnings
- warnings.warn(msg, warningcls, stacklevel=2)
+ import _warnings
+ _warnings.warn(msg, warningcls, stacklevel=2)
""")
def resolve_target(self, w_obj):
More information about the pypy-commit
mailing list