homepage

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.

classification
Title: Argument Clinic: unhelpful crashes
Type: behavior Stage: resolved
Components: Demos and Tools Versions: Python 3.4
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Argument Clinic: support for simple expressions?
View: 20226
Assigned To: larry Nosy List: larry, serhiy.storchaka, zach.ware
Priority: normal Keywords:

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) * (Python committer) 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) * (Python committer) 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) * (Python committer) 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) * (Python committer) 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) * (Python committer) Date: 2014年01月15日 20:50
Thank you Zachary.
History
Date User Action Args
2022年04月11日 14:57:57adminsetgithub: 64472
2014年01月15日 20:50:15serhiy.storchakasetmessages: + msg208195
2014年01月15日 20:44:48zach.waresetsuperseder: Argument Clinic: support for simple expressions?

messages: + msg208194
nosy: + zach.ware
2014年01月15日 20:40:13larrysetstatus: open -> closed
messages: + msg208193

assignee: larry
resolution: duplicate
stage: resolved
2014年01月15日 20:25:43serhiy.storchakasetmessages: + msg208190
2014年01月15日 20:17:32serhiy.storchakacreate

AltStyle によって変換されたページ (->オリジナル) /