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 marco.buttu
Recipients anish.shah, brett.cannon, giampaolo.rodola, gvanrossum, marco.buttu, yselivanov
Date 2016-02-12.13:53:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1455285204.8.0.0672113107652.issue26182@psf.upfronthosting.co.za>
In-reply-to
Content
Thank you Brett, the problem was the missed exec(). With the patch in attachment the tests pass, but it does not seem to me a good solution. Infact, changing the filter at runtime has no effect: 

$ cat foo.py 
import warnings

warnings.simplefilter("always")
async = 33
await = 33

$ ./python foo.py 
$

Does this happen because, putting the PyErr_WarnEx() in Python/ast.c, the warning is issued before the runtime?

Furthermore, if I set the filter from the CL, then the warning is properly triggered, but the file name and line number are wrong: 

$ ./python -Wd foo.py 
sys:1: DeprecationWarning: 'async' will become a reserved keyword in Python 3.7
sys:1: DeprecationWarning: 'await' will become a reserved keyword in Python 3.7
History
Date User Action Args
2016-02-12 13:53:24marco.buttusetrecipients: + marco.buttu, gvanrossum, brett.cannon, giampaolo.rodola, yselivanov, anish.shah
2016-02-12 13:53:24marco.buttusetmessageid: <1455285204.8.0.0672113107652.issue26182@psf.upfronthosting.co.za>
2016-02-12 13:53:24marco.buttulinkissue26182 messages
2016-02-12 13:53:24marco.buttucreate