- Python Home
- About
- News
- Documentation
- Downloads
- Community
- Foundation
- Developer's Guide
- Issue Tracker
- Issues
- Summaries
- User
- Administration
- Help
Issue18656
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 2013-08-04 16:55 by gvanrossum, last changed 2022-04-11 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| functools_wraps_oddity.py | gvanrossum, 2013-08-04 20:50 | |||
| Messages (8) | |||
|---|---|---|---|
| msg194394 - (view) | Author: Guido van Rossum (gvanrossum) * ![]() |
Date: 2013-08-04 16:55 | |
In Python 3.2 and earlier: >>> def f(): pass ... >>> f.__name__ = 'g' >>> f <function g at 0x100487628> However in Python 3.3 and later, the last line shows 'f' instead of 'g'. |
|||
| msg194395 - (view) | Author: Mark Dickinson (mark.dickinson) * ![]() |
Date: 2013-08-04 17:02 | |
I guess this is a direct consequence of PEP 3155 [1]. From the PEP: """ The repr() and str() of functions and classes is modified to use __qualname__ rather than __name__. """ [1] http://www.python.org/dev/peps/pep-3155/ |
|||
| msg194396 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2013-08-04 17:12 | |
Python 3.4.0a0 (default:62658d9d8926+, Aug 1 2013, 23:05:18) [GCC 4.4.1 20090725 (Red Hat 4.4.1-2)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> def func(): pass ... >>> func <function func at 0xb7698a54> >>> func.__qualname__="PEP 3155" >>> func <function PEP 3155 at 0xb7698a54> |
|||
| msg194402 - (view) | Author: Madison May (madison.may) * | Date: 2013-08-04 18:05 | |
Yup, here are the relevant lines of the diff for PEP 3155: @@ -568,7 +607,7 @@ func_repr(PyFunctionObject *op) { return PyUnicode_FromFormat("<function %U at %p>", - op->func_name, op); + op->func_qualname, op); } |
|||
| msg194420 - (view) | Author: Guido van Rossum (gvanrossum) * ![]() |
Date: 2013-08-04 20:50 | |
Sorry. The actual problem reported was that the traceback uses the wrong name. I can still reproduce this in 3.4; attached is a repro. |
|||
| msg194421 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2013-08-04 20:58 | |
That's because argument error messages use the code's co_name rather than the functions. (This is a dupe of another bug about this that I can't find.) |
|||
| msg194422 - (view) | Author: Mark Dickinson (mark.dickinson) * ![]() |
Date: 2013-08-04 21:02 | |
http://bugs.python.org/issue4322 ? |
|||
| msg194423 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2013-08-04 21:05 | |
Exactly |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:49 | admin | set | github: 62856 |
| 2013-08-04 21:05:14 | benjamin.peterson | set | status: open -> closed superseder: function with modified __name__ uses original name when there's an arg error resolution: duplicate messages: + msg194423 |
| 2013-08-04 21:02:27 | mark.dickinson | set | messages: + msg194422 |
| 2013-08-04 20:58:43 | benjamin.peterson | set | nosy:
+ benjamin.peterson messages: + msg194421 |
| 2013-08-04 20:50:08 | gvanrossum | set | files:
+ functools_wraps_oddity.py messages: + msg194420 |
| 2013-08-04 18:05:27 | madison.may | set | nosy:
+ madison.may messages: + msg194402 |
| 2013-08-04 17:12:08 | vstinner | set | nosy:
+ vstinner messages: + msg194396 |
| 2013-08-04 17:11:13 | jcea | set | nosy:
+ jcea |
| 2013-08-04 17:02:50 | mark.dickinson | set | nosy:
+ mark.dickinson, pitrou messages: + msg194395 |
| 2013-08-04 16:55:25 | gvanrossum | create | |


