[issue37718] 2to3 exception handling

2020-11-25 Thread Irit Katriel


Irit Katriel  added the comment:

Right, the message field on exceptions was removed in python 3 (it was 
deprecated since Python 2.6).

2to3 can't automatically fix this, because as a static translator it doesn't 
know that the object on which you are accessing .message is an exception.

--
nosy: +iritkatriel
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue37718] 2to3 exception handling

2019-08-07 Thread hai shi


hai shi  added the comment:

1. the message property of PyBaseExceptionObject(Exception) have been cancelled.

[1] https://github.com/python/cpython/blob/2.7/Include/pyerrors.h#L13
[2] https://github.com/python/cpython/blob/master/Include/cpython/pyerrors.h#L18

2. `except Exception, e` is a python2.x behavior, pls use `except Exception as 
e` in python3.x

--
nosy: +shihai1991

___
Python tracker 

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



[issue37718] 2to3 exception handling

2019-07-30 Thread Xinmeng Xia


New submission from Xinmeng Xia :

we run the converted Python3 code, the following error will happen:
Traceback (most recent call last):
  File "/home/xxm/Desktop/instrument/datasetpy3/Labeled-LDA-Python/example.py", 
line 50, in 
llda_model.save_model_to_dir(save_model_dir)
  File 
"/home/xxm/Desktop/instrument/datasetpy3/Labeled-LDA-Python/model/labeled_lda.py",
 line 697, in save_model_to_dir
LldaModel._write_object_to_file(save_model_path, save_model.__dict__)
  File 
"/home/xxm/Desktop/instrument/datasetpy3/Labeled-LDA-Python/model/labeled_lda.py",
 line 650, in _write_object_to_file
print(("%s\n\t%s" % (message, e.message)))
AttributeError: 'TypeError' object has no attribute 'message'

it seems that attributes change between Python2 and Python3. However 2to3 lack 
for this fix when dealing with exception fix.

--
components: 2to3 (2.x to 3.x conversion tool)
files: labeled_lda.py
messages: 348720
nosy: xxm
priority: normal
severity: normal
status: open
title: 2to3  exception handling
versions: Python 3.7
Added file: https://bugs.python.org/file48516/labeled_lda.py

___
Python tracker 

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