Author: Armin Rigo <[email protected]>
Branch: py3.6
Changeset: r91881:766b07d52393
Date: 2017-07-15 18:59 +0200
http://bitbucket.org/pypy/pypy/changeset/766b07d52393/
Log: merge heads
diff --git a/lib-python/3/weakref.py b/lib-python/3/weakref.py
--- a/lib-python/3/weakref.py
+++ b/lib-python/3/weakref.py
@@ -16,8 +16,8 @@
proxy,
CallableProxyType,
ProxyType,
- ReferenceType,
- _remove_dead_weakref)
+ ReferenceType
+)
from _weakrefset import WeakSet, _IterationGuard
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
@@ -4,7 +4,7 @@
class Module(MixedModule):
applevel_name = '__exceptions__'
appleveldefs = {}
-
+
interpleveldefs = {
'ArithmeticError' : 'interp_exceptions.W_ArithmeticError',
'AssertionError' : 'interp_exceptions.W_AssertionError',
@@ -39,6 +39,7 @@
'KeyboardInterrupt' : 'interp_exceptions.W_KeyboardInterrupt',
'LookupError' : 'interp_exceptions.W_LookupError',
'MemoryError' : 'interp_exceptions.W_MemoryError',
+ 'ModuleNotFoundError': 'interp_exceptions.W_ModuleNotFoundError',
'NameError' : 'interp_exceptions.W_NameError',
'NotADirectoryError': 'interp_exceptions.W_NotADirectoryError',
'NotImplementedError' : 'interp_exceptions.W_NotImplementedError',
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
@@ -345,6 +345,10 @@
W_UnicodeError = _new_exception('UnicodeError', W_ValueError,
"""Unicode related error.""")
+W_ModuleNotFoundError = _new_exception(
+ 'ModuleNotFoundError', W_ImportError, """Module not found."""
+)
+
class W_UnicodeTranslateError(W_UnicodeError):
"""Unicode translation error."""
diff --git a/pypy/module/exceptions/test/test_exc.py
b/pypy/module/exceptions/test/test_exc.py
--- a/pypy/module/exceptions/test/test_exc.py
+++ b/pypy/module/exceptions/test/test_exc.py
@@ -296,6 +296,14 @@
assert ImportError("message", path="y").path == "y"
raises(TypeError, ImportError, invalid="z")
+ def test_modulenotfounderror(self):
+ assert ModuleNotFoundError("message").name is None
+ assert ModuleNotFoundError("message").path is None
+ assert ModuleNotFoundError("message", name="x").name == "x"
+ assert ModuleNotFoundError("message", path="y").path == "y"
+ raises(TypeError, ModuleNotFoundError, invalid="z")
+ assert repr(ModuleNotFoundError('test')) ==
"ModuleNotFoundError('test',)"
+
def test_blockingioerror(self):
args = ("a", "b", "c", "d", "e")
for n in range(6):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit