Issue 28100: Refactor error messages in symtable.c (original) (raw)

Issue28100

Created on 2016-09-12 11:43 by levkivskyi, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
refactor-error-msg.diff levkivskyi,2016-09-12 11:43 review
refactor-error-msg-v2.diff levkivskyi,2016-09-21 15:37 review
Messages (4)
msg276024 - (view) Author: Ivan Levkivskyi (levkivskyi) * (Python committer) Date: 2016-09-12 11:43
Patch with added comment and a minor refactoring to error messages in symtable.c Now the error message is simply always overwritten by any more "severe" SyntaxError found in the same block.
msg277150 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2016-09-21 14:56
Please rewrite the patch to use if / else if / else, e.g. if (cur & (DEF_LOCAL | USE DEF_ANNOT)) { ... if (cur & USE) { msg = GLOBAL_AFTER_USE; } else if (cur & DEF_LOCAL) { msg = GLOBAL_AFTER_ASSIGN; } else { /* DEF_ANNOT */ msg = GLOBAL_ANNOT; } ... }
msg277164 - (view) Author: Ivan Levkivskyi (levkivskyi) * (Python committer) Date: 2016-09-21 15:37
Here is the patch for 3.6 with requested changes. While playing with this a bit more, I discovered that the error message in this case (if no value is actually assigned): def f(): x: int global x could be misleading. Therefore I changed the order of DEF_LOCAL and DEF_ANNOT to get a more clear error message for such cases (this does not spoil error messages in other cases).
msg277291 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-09-23 18:26
New changeset 966b57281536 by Christian Heimes in branch '3.6': Issue #28100: Refactor error messages, patch by Ivan Levkivskyi https://hg.python.org/cpython/rev/966b57281536 New changeset a953112116ac by Christian Heimes in branch 'default': Issue #28100: Refactor error messages, patch by Ivan Levkivskyi https://hg.python.org/cpython/rev/a953112116ac
History
Date User Action Args
2022-04-11 14:58:36 admin set github: 72287
2016-10-07 22:28:59 levkivskyi set status: open -> closedresolution: fixed
2016-09-23 18:26:55 python-dev set nosy: + python-devmessages: +
2016-09-21 15:37:15 levkivskyi set files: + refactor-error-msg-v2.diffmessages: +
2016-09-21 14:56:00 christian.heimes set messages: +
2016-09-12 11:43:04 levkivskyi create