New submission from daniel hahler <python-b...@thequod.de>:

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.

----------
components: Library (Lib)
messages: 348201
nosy: blueyed
priority: normal
severity: normal
status: open
title: doc: "module" of a warning might be its filename
type: behavior
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37634>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to