Author: Amaury Forgeot d'Arc <[email protected]>
Branch: py3k
Changeset: r48007:2ad1a5d0adfb
Date: 2011-10-13 01:19 +0200
http://bitbucket.org/pypy/pypy/changeset/2ad1a5d0adfb/

Log:    Add ResourceWarning. Not used yet, but now "import warnings" passes!

diff --git a/pypy/module/exceptions/__init__.py 
b/pypy/module/exceptions/__init__.py
--- a/pypy/module/exceptions/__init__.py
+++ b/pypy/module/exceptions/__init__.py
@@ -12,6 +12,7 @@
         'BufferError' : 'interp_exceptions.W_BufferError',
         'BytesWarning'  : 'interp_exceptions.W_BytesWarning',
         'DeprecationWarning' : 'interp_exceptions.W_DeprecationWarning',
+        'ResourceWarning'  : 'interp_exceptions.W_ResourceWarning',
         'EOFError' : 'interp_exceptions.W_EOFError',
         'EnvironmentError' : 'interp_exceptions.W_EnvironmentError',
         'Exception' : 'interp_exceptions.W_Exception',
diff --git a/pypy/module/exceptions/interp_exceptions.py 
b/pypy/module/exceptions/interp_exceptions.py
--- a/pypy/module/exceptions/interp_exceptions.py
+++ b/pypy/module/exceptions/interp_exceptions.py
@@ -70,6 +70,7 @@
            +-- ImportWarning
            +-- UnicodeWarning
            +-- BytesWarning
+           +-- ResourceWarning
 """
 
 from pypy.interpreter.baseobjspace import Wrappable
@@ -463,6 +464,9 @@
 W_DeprecationWarning = _new_exception('DeprecationWarning', W_Warning,
                         """Base class for warnings about deprecated 
features.""")
 
+W_ResourceWarning = _new_exception('ResourceWarning', W_Warning,
+         """Base class for warnings about resource usage.""")
+
 W_ArithmeticError = _new_exception('ArithmeticError', W_StandardError,
                          """Base class for arithmetic errors.""")
 
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to