Issue1981

classification
Title: ast.And and ast.Or should be subclasses of ast.boolop
Type: Severity: normal
Components: Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, amak, darjus, fwierzbicki
Priority: normal Keywords:

Created on 2012-10-23.22:09:12 by Arfrever, last changed 2014-05-17.20:54:44 by fwierzbicki.

Messages
msg7486 (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) Date: 2012-10-23.22:09:12
ast.And and ast.Or should be subclasses of ast.boolop.
This bug is present in Jython 2.5 and 2.7.

In Jython 2.7:

>>> import ast
>>> [issubclass(getattr(ast, x), ast.boolop) for x in ('And', 'Or')]
[False, False]

In CPython 2.7:

>>> import ast
>>> [issubclass(getattr(ast, x), ast.boolop) for x in ('And', 'Or')]
[True, True]
msg7503 (view) Author: Darjus Loktevic (darjus) Date: 2012-11-04.17:59:26
I can confirm this, but i think the problem is more widespread.

Looking at asdl_antlr.py it seems that every op is has a base of _ast.AST as opposed to _ast.boolop or _ast.operator, etc.

Not sure what needs to happen here - Frank?
msg7852 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2013-02-27.18:34:54
Hi Darjus, yeah these are trouble. What I *really* want to do someday is implement all of ast.py in pure python so the subclassing is easy, but that will be a somewhat big project.
msg7853 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2013-02-27.18:35:26
Darjus: if by chance you are interested in taking that task up I can fill you in :)
msg8433 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2014-05-17.20:54:43
Fixed. http://hg.python.org/jython/rev/b3f5c51c0a83
History
Date User Action Args
2014-05-17 20:54:44fwierzbickisetstatus: open -> closed
resolution: fixed
messages: + msg8433
2013-02-27 18:35:46fwierzbickisetpriority: normal
2013-02-27 18:35:26fwierzbickisetmessages: + msg7853
2013-02-27 18:34:54fwierzbickisetmessages: + msg7852
2013-02-09 14:38:05amaksetnosy: + amak
2012-11-04 17:59:27darjussetnosy: + darjus
messages: + msg7503
2012-10-23 22:09:12Arfrevercreate