Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4268)

#13266: Add inspect.unwrap(f) to easily unravel "__wrapped__" chains

Can't Edit
Can't Publish+Mail
Start Review
Created:
1 year ago by ncoghlan
Modified:
6 months, 3 weeks ago
Reviewers:
merwok, aaron.iles, ezio.melotti, urban.dani+py
CC:
rhettinger, jcea, Nick Coghlan, ezio.melotti, eric.araujo, flox, meadori, durban, aliles
Visibility:
Public.

Patch Set 1 #

Total comments: 5

Patch Set 2 #

Total comments: 6

Patch Set 3 #

Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Doc/library/inspect.rst View 1 2 1 chunk +10 lines, -0 lines 0 comments Download
Lib/inspect.py View 1 2 2 chunks +21 lines, -7 lines 0 comments Download
Lib/test/test_inspect.py View 1 2 4 chunks +37 lines, -1 line 0 comments Download

Messages

Total messages: 5
eric.araujo
http://bugs.python.org/review/13266/diff/4751/16851 File Lib/inspect.py (right): http://bugs.python.org/review/13266/diff/4751/16851#newcode1232 Lib/inspect.py:1232: raise ValueError('wrapper loop') Idea: include the func name in ...
1 year ago #1
aliles
Reviewed changes. Needed to make minor changes to the patches to get them to apply ...
9 months ago #2
eric.araujo
http://bugs.python.org/review/13266/diff/4751/Lib/inspect.py File Lib/inspect.py (right): http://bugs.python.org/review/13266/diff/4751/Lib/inspect.py#newcode1221 Lib/inspect.py:1221: def unwrap(func): Yes please. http://bugs.python.org/review/13266/diff/4751/Lib/test/test_inspect.py File Lib/test/test_inspect.py (right): http://bugs.python.org/review/13266/diff/4751/Lib/test/test_inspect.py#newcode1172 ...
9 months ago #3
ezio.melotti
http://bugs.python.org/review/13266/diff/6441/Doc/library/inspect.rst File Doc/library/inspect.rst (right): http://bugs.python.org/review/13266/diff/6441/Doc/library/inspect.rst#newcode800 Doc/library/inspect.rst:800: Get the object wrapped by *func*. If follows the ...
6 months, 3 weeks ago #4
durban
6 months, 3 weeks ago #5
http://bugs.python.org/review/13266/diff/6441/Lib/inspect.py
File Lib/inspect.py (right):

http://bugs.python.org/review/13266/diff/6441/Lib/inspect.py#newcode373
Lib/inspect.py:373: memo = {id(func)}
On 2012/11/04 05:23:39, ezio.melotti wrote:
> Why the id and not func itself?

Because func may not by hashable of may not have an identity hash.

http://bugs.python.org/review/13266/diff/6441/Lib/test/test_inspect.py
File Lib/test/test_inspect.py (right):

http://bugs.python.org/review/13266/diff/6441/Lib/test/test_inspect.py#newcod...
Lib/test/test_inspect.py:2300: self.assertIs(inspect.unwrap(C()), None)
On 2012/11/04 05:23:39, ezio.melotti wrote:
> I would also test with some other decorators of the stdlib.

I wasn't able to find another decorator in the stdlib that sets __wrapped__.
Could you suggest some?
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7