This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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 <>
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')" >
    $ echo "import bad_escape" >
    $ ./python -W all 
    _frozen_importlib:205: DeprecationWarning: invalid escape sequence '\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 
    def f():
        x = 1
        global x
    $ python3 -c "import syntax_warning" 
    /home/ncoghlan/devel/py36/ SyntaxWarning: name 'x' is assigned to before global declaration
      global x

(Run with 3.5, as that became a full SyntaxError for 3.6)
Date User Action Args
2016-09-16 02:05:58ncoghlansetrecipients: + ncoghlan, brett.cannon, rhettinger, ned.deily, r.david.murray, martin.panter, serhiy.storchaka, yselivanov, Tim.Graham, yan12125, abarry
2016-09-16 02:05:58ncoghlansetmessageid: <>
2016-09-16 02:05:58ncoghlanlinkissue28128 messages
2016-09-16 02:05:57ncoghlancreate