[issue37780] A strange bug in eval() not present in Python 3

2019-08-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: This isn't a bug. In Python 2, True and False are variable names rather than keywords. That means they can be shadowed: >>> False = 10 >>> True = 20 >>> [False, True] [10, 20] A Counter() is a kind a dictionary that returns zero rather than raising a

[issue37780] A strange bug in eval() not present in Python 3

2019-08-06 Thread wang xuancong
New submission from wang xuancong : We all know that since: [False, True, False].count(True) gives 1 eval('[False, True, False].count(True)') also gives 1. However, in Python 2, eval('[False, True, False].count(True)', {}, Counter()) gives 3, while eval('[False, True, False].count(True)', {},