[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 bug
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 these arguments and calls the original 
callback with no arguments is always needed, right?

--
nosy: +pablogsal

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 
better to skip adding the redundant wrapper function.

--
messages: 309171
nosy: barry, ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Skip creating redundant wrapper functions in ExitStack.callback
type: performance
versions: Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com