[issue30238] 2to3 doesn't detect or fix Exception indexing

2021-10-20 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

See the superseding issue; 2to3 is deprecated and headed towards deletion.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30238] 2to3 doesn't detect or fix Exception indexing

2021-10-20 Thread Daniel Lenski


Daniel Lenski  added the comment:

Why was this closed?

As I wrote in a previous comment, this situation can be automatically 
identified and addressed via static analysis in the vastly-predominant case, 
where the Exception object is assigned via an `exception ... as exc:` clause.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30238] 2to3 doesn't detect or fix Exception indexing

2021-10-20 Thread Irit Katriel


Change by Irit Katriel :


--
stage: test needed -> resolved
status: open -> closed
superseder:  -> Close 2to3 issues and list them here

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30238] 2to3 doesn't detect or fix Exception indexing

2021-06-21 Thread Daniel Lenski


Daniel Lenski  added the comment:

> There is no way to know through static analysis that the subscript is on an 
> object of type exception. I think this should be closed as won't fix.

In almost all cases, the variable in question will receive its value via 
`except ... as e:`.

   try:
   ...
   except (Exception1, Exception2, ...) as e:
   e[0]

Seems to me that it should be possible for 2to3 to handle this large subset of 
applicable cases via static analysis.

--
status: pending -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30238] 2to3 doesn't detect or fix Exception indexing

2021-06-20 Thread Irit Katriel


Irit Katriel  added the comment:

There is no way to know through static analysis that the subscript is on an 
object of type exception. I think this should be closed as won't fix.

--
nosy: +iritkatriel
resolution:  -> wont fix
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30238] 2to3 doesn't detect or fix Exception indexing

2018-09-11 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30238] 2to3 doesn't detect or fix Exception indexing

2017-05-05 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +benjamin.peterson
stage:  -> test needed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30238] 2to3 doesn't detect or fix Exception indexing

2017-05-02 Thread Daniel Lenski

New submission from Daniel Lenski:

Python 2.7 allows indexing an Exception object to access its args list.

>>> e=Exception('foo','bar','baz')
>>> assert e[0] is e.args[0]

This doesn't work in 3.5:

>>> e=Exception('foo','bar','baz')
>>> e.args[0]
'foo'
>>> e[0]
TypeError: 'Exception' object is not subscriptable

This conversion (e[x] -> e.args[x]) seems like it ought to be fairly 
straightforward to support in 2to3.

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 292799
nosy: dlenski
priority: normal
severity: normal
status: open
title: 2to3 doesn't detect or fix Exception indexing
type: enhancement
versions: Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com