Issue 20273: Argument Clinic: unhelpful crashes
Issue20273
Created on 2014-01-15 20:17 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin. This issue is now closed.
| Messages (5) | |||
|---|---|---|---|
| msg208188 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2014-01-15 20:17 | |
Sometimes when Argument Clinic see something wrong, it raises exception and exit with printed traceback, instead of output helpful error message which points on line with illegal syntax. I open this issue to report about such problems. $ ./python Tools/clinic/clinic.py -f Modules/zlibmodule.c Traceback (most recent call last): File "Tools/clinic/clinic.py", line 3032, in <module> sys.exit(main(sys.argv[1:])) File "Tools/clinic/clinic.py", line 3028, in main parse_file(filename, output=ns.output, verify=not ns.force) File "Tools/clinic/clinic.py", line 1135, in parse_file cooked = clinic.parse(raw) File "Tools/clinic/clinic.py", line 1085, in parse parser.parse(block) File "Tools/clinic/clinic.py", line 2262, in parse self.state(line) File "Tools/clinic/clinic.py", line 2582, in state_parameter value = eval(py_default) File "<string>", line 1, in <module> NameError: name 'zlib' is not defined zlibmodule.c is almost same as after applying patch from issue20193 (with several clinic bugs already fixed). |
|||
| msg208190 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2014-01-15 20:25 | |
I suppose this crash is caused by this code:
/*[clinic input]
zlib.Compress.flush
self: self(type="compobject *")
mode: int(c_default="Z_FINISH") = zlib.Z_FINISH
One of the constants Z_SYNC_FLUSH, Z_FULL_FLUSH, Z_FINISH.
If mode == Z_FINISH, the compressor object can no longer be used after
calling the flush() method. Otherwise, more data can still be compressed.
/
Return a bytes object containing any remaining compressed data.
[clinic start generated code]*/
It was valid several days ago.
Therefore here are two bugs:
1. Argument Clinic should output a line number where it has encountered illegal expression.
2. It should accept zlib.Z_FINISH (Z_FINISH is exported constant in the zlib module).
|
|||
| msg208193 - (view) | Author: Larry Hastings (larry) * ![]() |
Date: 2014-01-15 20:40 | |
I'm marking this as a duplicate of #20226, the "add general-purpose expressions" issue, because that will fix the behavior you're seeing. As for "in general Argument Clinic should have better error reporting", this is too general for an issue right now. In the future feel free to file issues for specific badly-phrased errors. |
|||
| msg208194 - (view) | Author: Zachary Ware (zach.ware) * ![]() |
Date: 2014-01-15 20:44 | |
Georg already opened an issue with a patch about providing a little more information in unexpected exceptions, see issue20235. |
|||
| msg208195 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2014-01-15 20:50 | |
Thank you Zachary. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:57 | admin | set | github: 64472 |
| 2014-01-15 20:50:15 | serhiy.storchaka | set | messages: + msg208195 |
| 2014-01-15 20:44:48 | zach.ware | set | superseder: Argument Clinic: support for simple expressions? |
| 2014-01-15 20:40:13 | larry | set | status: open -> closed messages: + msg208193 assignee: larry |
| 2014-01-15 20:25:43 | serhiy.storchaka | set | messages: + msg208190 |
| 2014-01-15 20:17:32 | serhiy.storchaka | create | |
