Issue24001
Created on 2015-04-19 01:06 by larry, last changed 2015-05-04 15:04 by larry. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| larry.clinic.use.raw.types.1.txt | larry, 2015-04-19 01:06 | review | ||
| larry.clinic.use.raw.types.2.txt | larry, 2015-04-19 19:29 | review | ||
| larry.clinic.use.raw.types.3.txt | larry, 2015-04-20 18:03 | review | ||
| Messages (11) | |||
|---|---|---|---|
| msg241469 - (view) | Author: Larry Hastings (larry) * | Date: 2015-04-19 01:06 | |
New proposed semantics for the types= parameter to converters: where possible, pass in actual types. The resulting syntax:
c: int(types={str}) # maps to 'U'
s: str(types={str, robuffer}, length=True, zeroes=True) # maps to 's#'
Since "buffer", "robuffer", and "rwbuffer" are fake pseudotypes, I created empty classes with those names.
Serhiy: with this change in place, the types= parameter uses almost the same number of characters as it used to when it was a string. (The new syntax requires commas between elements, so for two or more types it's slightly longer.) Yet this makes the types= parameter far more accurate in illustrating what it's supposed to represent.
Does this make you happy? :)
|
|||
| msg241476 - (view) | Author: Larry Hastings (larry) * | Date: 2015-04-19 05:34 | |
Should types= be renamed accept= ? It's a set of the types of the Python objects that this parameter should accept. |
|||
| msg241479 - (view) | Author: Larry Hastings (larry) * | Date: 2015-04-19 05:40 | |
I should mention that evalify_node() is pretty hacked up here, and is not ready to be checked in. (I'm proposing separately that we simply add something like this directly into the standard library, see issue #24002.) |
|||
| msg241481 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2015-04-19 05:51 | |
accept= (or accept_types=) LGTM. |
|||
| msg241532 - (view) | Author: Larry Hastings (larry) * | Date: 2015-04-19 18:39 | |
Thanks to #24002 I now know how to write evalify_node properly. This revision of the patch is much better, and maybe ready for checkin. |
|||
| msg241535 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2015-04-19 18:48 | |
Looks as this is a patch for different issue. |
|||
| msg241552 - (view) | Author: Larry Hastings (larry) * | Date: 2015-04-19 19:28 | |
Whoops. I'll fix that. |
|||
| msg241553 - (view) | Author: Larry Hastings (larry) * | Date: 2015-04-19 19:29 | |
Here's the right patch. |
|||
| msg241671 - (view) | Author: Larry Hastings (larry) * | Date: 2015-04-20 18:03 | |
Attached is a patch implementing all my proposed changes here:
* "types" is now renamed "accept"
* it accepts a set of real Python types
* there are placeholder types for buffer, robuffer, rwbuffer
* "nullable=True" is gone, replaced with adding NoneType to accept={}
|
|||
| msg241689 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2015-04-20 22:05 | |
Usually converters are named by the C type of the result. May be rename the "str" converter to "pchar"? |
|||
| msg242558 - (view) | Author: Roundup Robot (python-dev) | Date: 2015-05-04 14:00 | |
New changeset 41fb7fd04b5d by Larry Hastings in branch 'default': Issue #24001: Argument Clinic converters now use accept={type} https://hg.python.org/cpython/rev/41fb7fd04b5d |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2015-05-04 15:04:21 | larry | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2015-05-04 14:00:11 | python-dev | set | nosy:
+ python-dev messages: + msg242558 |
| 2015-04-20 22:05:08 | serhiy.storchaka | set | messages: + msg241689 |
| 2015-04-20 18:03:57 | larry | set | files:
+ larry.clinic.use.raw.types.3.txt messages: + msg241671 |
| 2015-04-19 19:29:11 | larry | set | files:
+ larry.clinic.use.raw.types.2.txt messages: + msg241553 |
| 2015-04-19 19:28:38 | larry | set | files: - larry.one.more.clinic.format.unit.map.cleanup.2.txt |
| 2015-04-19 19:28:31 | larry | set | messages: + msg241552 |
| 2015-04-19 18:48:05 | serhiy.storchaka | set | messages: + msg241535 |
| 2015-04-19 18:39:59 | larry | set | files:
+ larry.one.more.clinic.format.unit.map.cleanup.2.txt messages: + msg241532 |
| 2015-04-19 05:51:32 | serhiy.storchaka | set | messages: + msg241481 |
| 2015-04-19 05:40:27 | larry | set | messages: + msg241479 |
| 2015-04-19 05:34:54 | larry | set | messages: + msg241476 |
| 2015-04-19 01:06:17 | larry | create | |