[issue32445] Skip creating redundant wrapper functions in ExitStack.callback

2018-01-01 Thread Nick Coghlan
Nick Coghlan added the comment: Ah, you're right, I wasn't thinking clearly when I filed this - the correct public API method to transfer existing exit stack entries to a new stack would be "ExitStack.push()". I'll make a note of that on the original issue. -- resolution: -> not a b

[issue32445] Skip creating redundant wrapper functions in ExitStack.callback

2017-12-31 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: I think I am missing something because the callbacks are always called with (exc_type, exc, tb) (check here https://github.com/python/cpython/blob/176baa326be4ec2dc70ca0c054b7e2ab7ca6a9cf/Lib/contextlib.py#L475) and therefore a wrapper that just drops

[issue32445] Skip creating redundant wrapper functions in ExitStack.callback

2017-12-29 Thread Nick Coghlan
New submission from Nick Coghlan : While discussing https://bugs.python.org/issue32145, I noticed that ExitStack.callback *always* adds a wrapper function, even when the `args` and `kwds` parameters are both empty. For plain callbacks that aren't receiving any extra arguments, it would be bet