[issue20381] Argument Clinic: expression default arguments broken

2014-01-24 Thread Larry Hastings
Larry Hastings added the comment: Right. So my advice is: only use local symbols and symbols in preloaded modules. -- ___ Python tracker ___ ___

[issue20381] Argument Clinic: expression default arguments broken

2014-01-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Hmm, no, we shouldn't use sys.modules, it's content is depended on modules used in Argument Clinic. -- ___ Python tracker ___ ___

[issue20381] Argument Clinic: expression default arguments broken

2014-01-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think we should specify globals (=sys.modules) and locals (=module.__dict__) arguments to eval. -- nosy: +serhiy.storchaka ___ Python tracker _

[issue20381] Argument Clinic: expression default arguments broken

2014-01-24 Thread Zachary Ware
Zachary Ware added the comment: Done, thanks for the review! -- assignee: larry -> zach.ware resolution: -> fixed stage: needs patch -> committed/rejected status: open -> closed ___ Python tracker

[issue20381] Argument Clinic: expression default arguments broken

2014-01-24 Thread Roundup Robot
Roundup Robot added the comment: New changeset 93afa651e074 by Zachary Ware in branch 'default': Issue #20381: Fix sanity checking on default arguments when c_default is http://hg.python.org/cpython/rev/93afa651e074 -- nosy: +python-dev ___ Python tra

[issue20381] Argument Clinic: expression default arguments broken

2014-01-24 Thread Zachary Ware
Zachary Ware added the comment: Here's a patch with my last suggestion, and the check for unspecified. -- Added file: http://bugs.python.org/file33694/issue20381.v3.diff ___ Python tracker _

[issue20381] Argument Clinic: expression default arguments broken

2014-01-24 Thread Larry Hastings
Larry Hastings added the comment: Yeah, that's a good approach. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscrib

[issue20381] Argument Clinic: expression default arguments broken

2014-01-24 Thread Zachary Ware
Zachary Ware added the comment: This will still cause issue in _sre.c; repr(sys.maxsize) == '9223372036854775807' != 'sys.maxsize'. Yes, it's bad form to throw the net too wide, but for anything other than NameError, we fail out in the next block anyway. My (second) patch just makes for nice

[issue20381] Argument Clinic: expression default arguments broken

2014-01-24 Thread Larry Hastings
Larry Hastings added the comment: How about this? I'm going to do a rollup patch today with three fixes: this, #20385, and changing the default filename for the "file" destination. -- Added file: http://bugs.python.org/file33692/larry.clinic.rollup.jan.24.diff.1.txt _

[issue20381] Argument Clinic: expression default arguments broken

2014-01-24 Thread Larry Hastings
Larry Hastings added the comment: It's considered bad form to catch Exception. We should catch the minimum necessary. If there are exceptions we forgot, people will complain and then we'll add those. Also, I want to make sure (if possible) that the value round-trips correctly through eval a

[issue20381] Argument Clinic: expression default arguments broken

2014-01-24 Thread Zachary Ware
Zachary Ware added the comment: How does this one strike you? Somewhat reversed logic compared to the first patch, but with this one we get either success or a nicely formatted fail message, no more tracebacks. -- Added file: http://bugs.python.org/file33691/issue20381.v2.diff __

[issue20381] Argument Clinic: expression default arguments broken

2014-01-24 Thread Larry Hastings
Larry Hastings added the comment: Let's not catch Exception there. Does catching NameError make the problem go away? And, #20189 changed the rules for simple expressions. Now names you want from the local module should not have the name of the module in front. You wouldn't have to do this

[issue20381] Argument Clinic: expression default arguments broken

2014-01-24 Thread Zachary Ware
Zachary Ware added the comment: Removing 'winreg.' gives the very similar traceback: Error in file "PC\winreg.c" on line 1351: Exception raised during parsing: Traceback (most recent call last): File "Tools\clinic\clinic.py", line 1541, in parse parser.parse(block) File "Tools\clinic\cli

[issue20381] Argument Clinic: expression default arguments broken

2014-01-24 Thread Larry Hastings
Larry Hastings added the comment: Remove the winreg. On Jan 24, 2014 8:02 AM, Zachary Ware wrote: > > > New submission from Zachary Ware: > > The fix for #20189 broke simple expression defaults.  Specifically, with the > latest #20172 patch applied, Clinic fails on winreg.c at winreg line 135

[issue20381] Argument Clinic: expression default arguments broken

2014-01-24 Thread Zachary Ware
Zachary Ware added the comment: This also prevents a vanilla trunk build (as of 85710aa396ef) from succeeding at 'Tools/clinic/clinic.py --make': Error in file ".\Modules\_sre.c" on line 574: Unsupported expression as default value: 'sys.maxsize' I think the only reasonable check we can do is

[issue20381] Argument Clinic: expression default arguments broken

2014-01-24 Thread Zachary Ware
New submission from Zachary Ware: The fix for #20189 broke simple expression defaults. Specifically, with the latest #20172 patch applied, Clinic fails on winreg.c at winreg line 1351 with this traceback: Error in file "PC\winreg.c" on line 1351: Exception raised during parsing: Traceback (mo