summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew/3.4.rst
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-06-16 22:05:54 (GMT)
committerBrett Cannon <brett@python.org>2013-06-16 22:05:54 (GMT)
commitf4375ef4d458bf24610ffef591f8197a3dbf0b35 (patch)
tree5ee2029fa137cf28d55afc5324caa9e57b209ac0 /Doc/whatsnew/3.4.rst
parent01b0475b08ab694e2eb0610d03b629afe22bb2a1 (diff)
downloadcpython-f4375ef4d458bf24610ffef591f8197a3dbf0b35.zip
cpython-f4375ef4d458bf24610ffef591f8197a3dbf0b35.tar.gz
cpython-f4375ef4d458bf24610ffef591f8197a3dbf0b35.tar.bz2
importlib.abc.SourceLoader.get_source() was re-raising SyntaxError and
UnicodeDecodeError as ImportError. That was over-reaching the point of raising ImportError in get_source() (which is to signal the source code was not found when it should have). Conflating the two exceptions with ImportError could lead to masking errors with the source which should be known outside of whether there was an error simply getting the source to begin with.
Diffstat (limited to 'Doc/whatsnew/3.4.rst')
-rw-r--r--Doc/whatsnew/3.4.rst9
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst
index fbe4b77..ec8429b 100644
--- a/Doc/whatsnew/3.4.rst
+++ b/Doc/whatsnew/3.4.rst
@@ -282,3 +282,12 @@ that may require changes to your code.
it would write to is a symlink or a non-regular file. This is to act as a
warning that import will overwrite those files with a regular file regardless
of what type of file path they were originally.
+
+* :meth:`importlib.abc.SourceLoader.get_source` no longer raises
+ :exc:`ImportError` when the source code being loaded triggers a
+ :exc:`SyntaxError` or :exc:`UnicodeDecodeError`. As :exc:`ImportError` is
+ meant to be raised only when source code cannot be found but it should, it was
+ felt to be over-reaching/overloading of that meaning when the source code is
+ found but improperly structured. If you were catching ImportError before and
+ wish to continue to ignore syntax or decoding issues, catch all three
+ exceptions now. \ No newline at end of file