classification
Title: doc: "module" of a warning might be its filename
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: blueyed
Priority: normal Keywords:

Created on 2019-07-19 23:02 by blueyed, last changed 2019-07-19 23:02 by blueyed.

Messages (1)
msg348201 - (view) Author: daniel hahler (blueyed) * Date: 2019-07-19 23:02
With e.g. DeprecationWarnings for "invalid escape sequence" the "module" part is the file name (with ".py" removed), because it calls PyErr_WarnExplicitObject directly:
https://github.com/python/cpython/blob/3cba3d3c55f230a59174a0dfcafb1d4685269e60/Python/ast.c#L4668-L4692

While this properly cannot be fixed to have the module name (yet), it should at least be documented then.

With `warnings.warn` the module is set via `setup_context` (https://github.com/python/cpython/blob/3cba3d3c55f230a59174a0dfcafb1d4685269e60/Python/_warnings.c#L932-L933).

This conflicts with https://github.com/python/cpython/pull/9358 (issue34624), which enables the documented behavior to not escape the pattern there.
History
Date User Action Args
2019-07-19 23:02:26blueyedcreate