Message276663
| Author | ncoghlan |
|---|---|
| Recipients | Tim.Graham, abarry, brett.cannon, martin.panter, ncoghlan, ned.deily, r.david.murray, rhettinger, serhiy.storchaka, yan12125, yselivanov |
| Date | 2016-09-16.02:05:57 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1473991558.27.0.295122910967.issue28128@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
I realised I wasn't entirely clear about the "warning misattribution" problem that's implied by Chi Hsuan's problem report, so here's the behaviour when using "-W all" rather than "-W error":
$ echo "print('\d')" > bad_escape.py
$ echo "import bad_escape" > escape_warning.py
$ ./python -W all escape_warning.py
_frozen_importlib:205: DeprecationWarning: invalid escape sequence '\d'
\d
That's a misattribution - the warning should be reported against the module being imported, not against the import system itself.
Compare that to the attribution of the old SyntaxWarning for assignments prior to a scope declaration:
$ cat syntax_warning.py
def f():
x = 1
global x
$ python3 -c "import syntax_warning"
/home/ncoghlan/devel/py36/syntax_warning.py:3: SyntaxWarning: name 'x' is assigned to before global declaration
global x
(Run with 3.5, as that became a full SyntaxError for 3.6) |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2016-09-16 02:05:58 | ncoghlan | set | recipients: + ncoghlan, brett.cannon, rhettinger, ned.deily, r.david.murray, martin.panter, serhiy.storchaka, yselivanov, Tim.Graham, yan12125, abarry |
| 2016-09-16 02:05:58 | ncoghlan | set | messageid: <1473991558.27.0.295122910967.issue28128@psf.upfronthosting.co.za> |
| 2016-09-16 02:05:58 | ncoghlan | link | issue28128 messages |
| 2016-09-16 02:05:57 | ncoghlan | create | |