mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-29762: More use "raise from None". (#569)
This hides unwanted implementation details from tracebacks.
This commit is contained in:
parent
43ba8861e0
commit
5affd23e6f
30 changed files with 50 additions and 48 deletions
|
@ -189,7 +189,7 @@ class BaseContext(object):
|
|||
try:
|
||||
ctx = _concrete_contexts[method]
|
||||
except KeyError:
|
||||
raise ValueError('cannot find context for %r' % method)
|
||||
raise ValueError('cannot find context for %r' % method) from None
|
||||
ctx._check_available()
|
||||
return ctx
|
||||
|
||||
|
|
|
@ -720,14 +720,14 @@ class IMapIterator(object):
|
|||
item = self._items.popleft()
|
||||
except IndexError:
|
||||
if self._index == self._length:
|
||||
raise StopIteration
|
||||
raise StopIteration from None
|
||||
self._cond.wait(timeout)
|
||||
try:
|
||||
item = self._items.popleft()
|
||||
except IndexError:
|
||||
if self._index == self._length:
|
||||
raise StopIteration
|
||||
raise TimeoutError
|
||||
raise StopIteration from None
|
||||
raise TimeoutError from None
|
||||
|
||||
success, value = item
|
||||
if success:
|
||||
|
|
|
@ -199,7 +199,7 @@ class BaseProcess(object):
|
|||
try:
|
||||
return self._sentinel
|
||||
except AttributeError:
|
||||
raise ValueError("process not started")
|
||||
raise ValueError("process not started") from None
|
||||
|
||||
def __repr__(self):
|
||||
if self is _current_process:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue