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 2012年06月25日 22:31 by Yury.Selivanov, last changed 2022年04月11日 14:57 by admin.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| contextlib.patch | Yury.Selivanov, 2012年06月25日 22:31 | review | ||
| Messages (4) | |||
|---|---|---|---|
| msg164021 - (view) | Author: Yury Selivanov (Yury.Selivanov) * | Date: 2012年06月25日 22:31 | |
With this patch 'contextlib.ExitStack.callback(callback, *args, **kwds)' will validate that the passed callback actually accept the passed '*args' and '**kwds'. P.S. If this patch comes through - I'll create two more issues for 'atexit.register' and 'unittest.TestCase.addCleanup'. (I'll also look through the stdlib to find if there are some other places where this is needed.) |
|||
| msg164024 - (view) | Author: Yury Selivanov (yselivanov) * (Python committer) | Date: 2012年06月26日 00:07 | |
(my previous message edit: no support for 'atexit' - it's implemented in C) |
|||
| msg164025 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2012年06月26日 01:02 | |
I'm not comfortable adding a dependency on inspect to the contextlib module, and I think it would be undesirable to have too many cases where the early validation is silently skipped. While I like the idea of adding early signature validation to these APIs in principle, given the above concerns and the fact this probably crosses the line into "feature" territory, I think we want to wait until 3.4 and the introduction of a mechanism that adds introspection support to callables implemented in C. That will likely involve moving the signature support somewhere lower in the module stack (perhaps to a private "_signature" module, with inspect remaining the official API), and will reduce the number of cases where pre-validation is skipped. |
|||
| msg367276 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2020年04月25日 16:18 | |
I think it is rather a work for linter's and static type checking. Runtime check adds an overhead, and it is expected that in correct program it will always pass. You need the check only while write the program, it may help in debugging. But once it has been debugged and tested, the check becomes a waste of CPU time. Since this issue was not touched for 8 years and there is a large progress in static code analysis, I suggest to close it. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:32 | admin | set | github: 59390 |
| 2020年04月25日 16:18:48 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg367276 |
| 2014年01月27日 20:33:43 | yselivanov | set | versions: + Python 3.5, - Python 3.4 |
| 2012年06月26日 01:02:41 | ncoghlan | set | messages:
+ msg164025 versions: + Python 3.4, - Python 3.3 |
| 2012年06月26日 00:07:28 | yselivanov | set | messages: + msg164024 |
| 2012年06月25日 23:11:34 | yselivanov | set | nosy:
+ yselivanov |
| 2012年06月25日 22:31:40 | Yury.Selivanov | create | |