File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -608,9 +608,18 @@ Available Context Managers
608608 If the *record * argument is :const: `False ` (the default) the context manager
609609 returns :class: `None ` on entry. If *record * is :const: `True `, a list is
610610 returned that is progressively populated with objects as seen by a custom
611- :func: `showwarning ` function (which also suppresses output to ``sys.stdout ``).
612- Each object in the list has attributes with the same names as the arguments to
613- :func: `showwarning `.
611+ :func: `showwarning ` function (which also suppresses output to ``sys.stderr ``).
612+ Each object in the list is guaranteed to have the following attributes:
613+
614+ - ``message ``: the warning message (an instance of :exc: `Warning `)
615+ - ``category ``: the warning category (a subclass of :exc: `Warning `)
616+ - ``filename ``: the file name where the warning occurred (str)
617+ - ``lineno ``: the line number in the file (int)
618+ - ``file ``: the file object used for output (if any)
619+ - ``line ``: the line of source code (if available)
620+ - ``source ``: the original object that generated the warning (if available)
621+
622+ The type of these objects is not specified and may change; only the presence of these attributes is guaranteed.
614623
615624 The *module * argument takes a module that will be used instead of the
616625 module returned when you import :mod: `warnings ` whose filter will be
You can’t perform that action at this time.
0 commit comments