Message208740
Attached is a *preliminary* patch for Argument Clinic that adds nullable ints. If you use the converter "int(nullable=True), then:
* The type you get back is not int but "nullable_int_t", a structure
containing three fields: "error", "is_null", and "i". "error" is 1 if
there was an error in parsing, else 0. "is_null" is 1 if None was
passed in, else 0. "i" is the integer value if an integer was
passed in, else undefined.
* You may now use a default value of None. If you do, "is_null" is 1.
* You may still use a default integer. If you do, "i" will be set
to that.
* If you use neither then obviously it's a required argument.
I'd appreciate just a preliminary review, saying something like
"this is a good idea, keep going," or
"you should change your approach," or
"this is a bad idea and should not be committed," or
"you look very handsome today Larry".
I don't remember who specifically needed the nullable ints, so I just added a bunch of Derby contestants.
Serhiy: I also added a fix for the bug you mentioned in #20294 after it was closed: the docstring for __new__ and __init__ methods now uses the class name instead of the name of the method. Note that this fix doesn't matter much; once I commit a fix for #20189, that signature will always be hidden. |
|
Date |
User |
Action |
Args |
2014-01-22 03:18:02 | larry | set | recipients:
+ larry, brett.cannon, georg.brandl, Yury.Selivanov, zach.ware, serhiy.storchaka, vajrasky |
2014-01-22 03:18:01 | larry | set | messageid: <1390360681.97.0.808723930218.issue20341@psf.upfronthosting.co.za> |
2014-01-22 03:18:01 | larry | link | issue20341 messages |
2014-01-22 03:18:01 | larry | create | |
|