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.
Created on 2008年01月06日 16:04 by robin.stocker, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| backport-keyword-only-arguments.patch | robin.stocker, 2008年01月06日 16:04 | backport of PEP 3102 | ||
| backport-keyword-only-arguments-full.patch | robin.stocker, 2008年01月08日 21:27 | also includes changes after r52491 | ||
| backport-keyword-only-arguments-full-2.patch | robin.stocker, 2008年03月23日 14:52 | applies cleanly again | ||
| backport-keyword-only-arguments-full-3.patch | gsakkis, 2010年03月22日 01:21 | Applies cleanly on r79264 | ||
| Messages (21) | |||
|---|---|---|---|
| msg59391 - (view) | Author: Robin Stocker (robin.stocker) | Date: 2008年01月06日 16:03 | |
The attached patch ports the implementation of keyword-only arguments from revision 52491 back to trunk. This is the first time I've worked on the C internals, so here are some notes: - test_collections is the only test which fails, because it tries to call a function with more than 255 arguments, which results in a SyntaxError because of the following added code in Python/ast.c. What should be done about it? if (nposargs + nkwonlyargs > 255) { ast_error(n, "more than 255 arguments"); return NULL; } - The patch only adds what's in revision 52491. There is at least one more change involving keyword-only arguments, for example issue1573. Are there others? Should they be included in this patch or in a separate one? - There are some changes which were generated, like Python/Python-ast.c (which needs to be checked in separately). - Is there documentation which needs to be updated? |
|||
| msg59406 - (view) | Author: Robin Stocker (robin.stocker) | Date: 2008年01月06日 21:24 | |
Another note: Because the marshalling of code objects is changed, is there a version number of the format which has to be incremented? |
|||
| msg59430 - (view) | Author: Guido van Rossum (gvanrossum) * (Python committer) | Date: 2008年01月07日 04:22 | |
Thanks for tackling this! What line in test_collections.py is calling a function with >255 args? I'm a bit surprised since this has always been disallowed AFAICT. I'd like to see everything related to keyword-only args included in one patch. Hopefully the unittests and/or svn history will give you an idea of what to do. There should be docs in the reference manual. Maybe Georg knows where. Don't worry about the generated Python-ast.c patch. The version number you're looking for is MAGIC in Python/import.c. |
|||
| msg59469 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2008年01月07日 17:28 | |
Keyword-only-args are not yet documented. |
|||
| msg59515 - (view) | Author: Robin Stocker (robin.stocker) | Date: 2008年01月08日 01:31 | |
Thanks for the feedback!
It's on line 111 in test_collections.py::
n = 10000
import string, random
names = [''.join([random.choice(string.letters) for j in
range(10)]) for i in range(n)]
Big = namedtuple('Big', names)
b = Big(*range(n))
I think the condition is triggered because Big's __new__ (which seems to
be dynamically generated by namedtuple using exec) has an argument list
with 10000 arguments.
Ok, I'm now looking through SVN logs and have already added some more
changes to my patchset.
Thanks, I had changed MAGIC but didn't know that marshal.c uses it.
So I won't handle documentation in this issue then.
|
|||
| msg59521 - (view) | Author: Christian Heimes (christian.heimes) * (Python committer) | Date: 2008年01月08日 03:55 | |
I vaguely remember that I had to modify the tests to use 254 args in Python 3.0. |
|||
| msg59523 - (view) | Author: Guido van Rossum (gvanrossum) * (Python committer) | Date: 2008年01月08日 05:01 | |
There's something I misunderstand then. I thought 2.x also didn't accept >255 args, but that test would seem to prove I'm wrong. |
|||
| msg59561 - (view) | Author: Robin Stocker (robin.stocker) | Date: 2008年01月08日 21:25 | |
Guido: The check was only done for call nodes, not for function definitions. |
|||
| msg59562 - (view) | Author: Robin Stocker (robin.stocker) | Date: 2008年01月08日 21:27 | |
Ok, I checked all the logs and updated the patch. test_collections uses n = 254 now and all tests pass. I left revision 54043 out on purpose, because it fixes Lib/inspect.py and Lib/pydoc.py for both PEP 3102 and 3107, so it should be included in the patch for PEP 3107. |
|||
| msg64366 - (view) | Author: Robin Stocker (robin.stocker) | Date: 2008年03月23日 14:52 | |
I've updated the patch to apply cleanly again. |
|||
| msg64665 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2008年03月29日 01:25 | |
Bumping priority. |
|||
| msg65249 - (view) | Author: Eric V. Smith (eric.smith) * (Python committer) | Date: 2008年04月09日 18:07 | |
The patch doesn't apply cleanly for me. I can fix the non-clean patch, but another error is that obj2ast_arguments doesn't call arguments() with the correct parameters. If I pass in NULL's for the new params, all tests pass, but that just tells me it's not being tested thoroughly. I'll spend some time looking at it, but if anyone else wants to look at it, go ahead. |
|||
| msg70360 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2008年07月28日 17:03 | |
This will probably have to be deferred to 2.7. |
|||
| msg70687 - (view) | Author: tav (tav) | Date: 2008年08月04日 07:35 | |
What's holding back the backport to 2.6? |
|||
| msg70739 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2008年08月05日 14:18 | |
On Mon, Aug 4, 2008 at 1:35 AM, tav <report@bugs.python.org> wrote: > > tav <tav@espians.com> added the comment: > > What's holding back the backport to 2.6? The fact that we are working towards the 3rd and final beta. > > ---------- > nosy: +tav > > _______________________________________ > Python tracker <report@bugs.python.org> > <http://bugs.python.org/issue1745> > _______________________________________ > -- Cheers, Benjamin Peterson "There's no place like 127.0.0.1." |
|||
| msg71654 - (view) | Author: Guido van Rossum (gvanrossum) * (Python committer) | Date: 2008年08月21日 16:11 | |
This will definitely not be in 2.6. |
|||
| msg85345 - (view) | Author: Michael Foord (michael.foord) * (Python committer) | Date: 2009年04月03日 23:55 | |
Running out of time for 2.7 as well... |
|||
| msg85348 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2009年04月03日 23:58 | |
2009年4月3日 Michael Foord <report@bugs.python.org>: > > Michael Foord <michael@voidspace.org.uk> added the comment: > > Running out of time for 2.7 as well... How so? The first 2.7 alpha probably won't be until the end of summer. |
|||
| msg101435 - (view) | Author: George Sakkis (gsakkis) | Date: 2010年03月21日 17:36 | |
Is there any update on this for 2.7 ? |
|||
| msg101475 - (view) | Author: George Sakkis (gsakkis) | Date: 2010年03月22日 01:21 | |
FWIW I updated the patch to r79264; it applies cleanly and passes the tests but other than that I can't tell if it's ready. It would be nice to have it in 2.7 though. |
|||
| msg109435 - (view) | Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) | Date: 2010年07月06日 22:23 | |
Now, that 2.7 is out we won't able to commit this anymore. It is sad to abandon a good patch like this. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:29 | admin | set | github: 46086 |
| 2010年07月06日 22:23:31 | alexandre.vassalotti | set | status: open -> closed resolution: wont fix messages: + msg109435 stage: patch review -> resolved |
| 2010年03月22日 01:21:57 | gsakkis | set | files:
+ backport-keyword-only-arguments-full-3.patch messages: + msg101475 |
| 2010年03月21日 17:36:01 | gsakkis | set | nosy:
+ gsakkis messages: + msg101435 |
| 2010年02月13日 17:25:36 | alexandre.vassalotti | set | messages: - msg99320 |
| 2010年02月13日 15:57:39 | alexandre.vassalotti | set | messages: + msg99320 |
| 2009年09月27日 15:09:51 | eric.araujo | set | nosy:
+ eric.araujo |
| 2009年08月06日 02:33:30 | alexandre.vassalotti | set | nosy:
+ alexandre.vassalotti stage: patch review |
| 2009年04月03日 23:58:17 | benjamin.peterson | set | messages: + msg85348 |
| 2009年04月03日 23:55:32 | michael.foord | set | nosy:
+ michael.foord messages: + msg85345 |
| 2009年01月17日 16:28:46 | benjamin.peterson | set | priority: critical -> normal |
| 2008年08月21日 16:11:45 | gvanrossum | set | keywords:
- 26backport messages: + msg71654 |
| 2008年08月21日 14:26:03 | benjamin.peterson | set | versions: + Python 2.7, - Python 2.6 |
| 2008年08月05日 14:18:38 | benjamin.peterson | set | messages: + msg70739 |
| 2008年08月04日 07:35:36 | tav | set | nosy:
+ tav messages: + msg70687 |
| 2008年07月28日 17:03:20 | benjamin.peterson | set | nosy:
+ benjamin.peterson messages: + msg70360 |
| 2008年04月09日 18:07:40 | eric.smith | set | messages: + msg65249 |
| 2008年03月29日 01:26:00 | georg.brandl | link | issue2327 superseder |
| 2008年03月29日 01:25:49 | georg.brandl | set | priority: normal -> critical keywords: + 26backport messages: + msg64665 |
| 2008年03月23日 14:52:20 | robin.stocker | set | files:
+ backport-keyword-only-arguments-full-2.patch messages: + msg64366 |
| 2008年03月18日 17:23:47 | eric.smith | set | nosy: + eric.smith |
| 2008年01月08日 21:27:59 | robin.stocker | set | files:
+ backport-keyword-only-arguments-full.patch messages: + msg59562 |
| 2008年01月08日 21:25:35 | robin.stocker | set | messages: + msg59561 |
| 2008年01月08日 05:01:32 | gvanrossum | set | messages: + msg59523 |
| 2008年01月08日 03:55:17 | christian.heimes | set | priority: normal nosy: + christian.heimes messages: + msg59521 |
| 2008年01月08日 01:31:09 | robin.stocker | set | messages: + msg59515 |
| 2008年01月07日 17:28:04 | georg.brandl | set | messages: + msg59469 |
| 2008年01月07日 04:22:59 | gvanrossum | set | keywords: + patch |
| 2008年01月07日 04:22:52 | gvanrossum | set | nosy:
+ gvanrossum, georg.brandl messages: + msg59430 |
| 2008年01月06日 21:24:52 | robin.stocker | set | messages: + msg59406 |
| 2008年01月06日 16:04:01 | robin.stocker | create | |