Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
b4b8f234
Kaydet (Commit)
b4b8f234
authored
Ara 09, 2012
tarafından
Nick Coghlan
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge from 3.3 (issue #15209)
üst
bb7da03f
0eee97cc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
exceptions.rst
Doc/library/exceptions.rst
+16
-8
No files found.
Doc/library/exceptions.rst
Dosyayı görüntüle @
b4b8f234
...
@@ -39,19 +39,27 @@ When raising (or re-raising) an exception in an :keyword:`except` clause
...
@@ -39,19 +39,27 @@ When raising (or re-raising) an exception in an :keyword:`except` clause
new exception is not handled the traceback that is eventually displayed will
new exception is not handled the traceback that is eventually displayed will
include the originating exception(s) and the final exception.
include the originating exception(s) and the final exception.
When raising a new exception (rather than using to bare ``raise`` to re-raise
When raising a new exception (rather than using a bare ``raise`` to re-raise
the exception currently being handled), the implicit exception chain can be
the exception currently being handled), the implicit exception context can be
made explicit by using :keyword:`from` with :keyword:`raise`. The single
supplemented with an explicit cause by using :keyword:`from` with
argument to :keyword:`from` must be an exception or ``None``. It will be set
:keyword:`raise`::
as :attr:`__cause__` on the raised exception. Setting :attr:`__cause__`
also implicitly sets the :attr:`__suppress_context__` attribute to
raise new_exc from original_exc
``True``.
The expression following :keyword:`from` must be an exception or ``None``. It
will be set as :attr:`__cause__` on the raised exception. Setting
:attr:`__cause__` also implicitly sets the :attr:`__suppress_context__`
attribute to ``True``, so that using ``raise new_exc from None``
effectively replaces the old exception with the new one for display
purposes (e.g. converting :exc:`KeyError` to :exc:`AttributeError`, while
leaving the old exception available in :attr:`__context__` for introspection
when debugging.
The default traceback display code shows these chained exceptions in
The default traceback display code shows these chained exceptions in
addition to the traceback for the exception itself. An explicitly chained
addition to the traceback for the exception itself. An explicitly chained
exception in :attr:`__cause__` is always shown when present. An implicitly
exception in :attr:`__cause__` is always shown when present. An implicitly
chained exception in :attr:`__context__` is shown only if :attr:`__cause__`
chained exception in :attr:`__context__` is shown only if :attr:`__cause__`
is
not set
and :attr:`__suppress_context__` is false.
is
:const:`None`
and :attr:`__suppress_context__` is false.
In either case, the exception itself is always shown after any chained
In either case, the exception itself is always shown after any chained
exceptions so that the final line of the traceback always shows the last
exceptions so that the final line of the traceback always shows the last
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment