@@ -611,9 +611,28 @@ Available Context Managers
611611 If the *record * argument is :const: `False ` (the default) the context manager
612612 returns :class: `None ` on entry. If *record * is :const: `True `, a list is
613613 returned that is progressively populated with objects as seen by a custom
614- :func: `showwarning ` function (which also suppresses output to ``sys.stdout ``).
615- Each object in the list has attributes with the same names as the arguments to
616- :func: `showwarning `.
614+ :func: `showwarning ` function (which also suppresses output to ``sys.stderr ``).
615+ Each object in the list is guaranteed to have the following attributes:
616+
617+ - ``message ``: the warning message (an instance of :exc: `Warning `)
618+ - ``category ``: the warning category (a subclass of :exc: `Warning `)
619+ - ``filename ``: the file name where the warning occurred (:class: `str `)
620+ - ``lineno ``: the line number in the file (:class: `int `)
621+ - ``file ``: the file object used for output (if any), or ``None ``
622+ - ``line ``: the line of source code (if available), or ``None ``
623+ - ``source ``: the original object that generated the warning (if
624+ available), or ``None ``
625+ - ``module ``: the module name where the warning occurred
626+ (:class: `str `), or ``None ``
627+
628+ .. versionchanged :: 3.6
629+ The ``source `` attribute was added.
630+
631+ .. versionchanged :: 3.15
632+ The ``module `` attribute was added.
633+
634+ The type of these objects is not specified and may change; only the
635+ presence of these attributes is guaranteed.
617636
618637 The *module * argument takes a module that will be used instead of the
619638 module returned when you import :mod: `!warnings ` whose filter will be
0 commit comments