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.

Title: 2to3 raise can silently remove code from old 2.4 string exceptions
Type: behavior Stage: resolved
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.8, Python 3.7
Status: closed Resolution: wont fix
Dependencies: Superseder: Close 2to3 issues and list them here
View: 45544
Assigned To: Nosy List: Rémy Oudompheng, benjamin.peterson
Priority: normal Keywords:

Created on 2020-05-07 16:37 by Rémy Oudompheng, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (1)
msg368355 - (view) Author: Rémy Oudompheng (Rémy Oudompheng) Date: 2020-05-07 16:37
When running "2to3 -f raise" on the following code, which uses an old Python 2.4 raise of a string:

def f():
    raise ("message %s %s" % (1, 2))


I obtain the following quite surprising result. I would have expected to get either an error or leave the original file unchanged, because "raise (s)" is syntactically valid although incorrect. 

$ 2to3 -f raise
RefactoringTool: Refactored
---	(original)
+++	(refactored)
@@ -1,5 +1,5 @@
 def f():
-    raise ("message %s %s" % (1, 2))
+    raise "message %s %s"
Date User Action Args
2022-04-11 14:59:30adminsetgithub: 84727
2021-10-20 22:55:32iritkatrielsetstatus: open -> closed
superseder: Close 2to3 issues and list them here
resolution: wont fix
stage: resolved
2020-05-08 21:41:34terry.reedysetnosy: + benjamin.peterson
2020-05-07 16:37:14Rémy Oudomphengcreate