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年02月12日 22:40 by giampaolo.rodola, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| profile-refactoring.diff | giampaolo.rodola, 2013年02月12日 22:40 | review | ||
| profile-refactoring.diff | giampaolo.rodola, 2013年02月17日 18:50 | review | ||
| Messages (6) | |||
|---|---|---|---|
| msg181980 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) | Date: 2013年02月12日 22:40 | |
profile and cProfile modules define the same utility functions (run() and runctx()) which use the same code except the profiler class. Considering that we're going to add 2 new utility functions (runcall() and runblock(), see issue9285 and issue17130) I think we should refactor the code in order to avoid this code duplication. Patch in attachment does that. The approach I came up with looks a bit hackish though so I'd like to get some feedback. Is it acceptable? |
|||
| msg182008 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2013年02月13日 10:09 | |
The patch doesn't look right to me. If you import cProfile, profile will always invoke the cProfile profiler. |
|||
| msg182010 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) | Date: 2013年02月13日 10:10 | |
No, it's the other way around. It's from cProfile which I import profile. diff --git a/Lib/cProfile.py b/Lib/cProfile.py --- a/Lib/cProfile.py +++ b/Lib/cProfile.py ... +import profile as _pyprofile |
|||
| msg182026 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2013年02月13日 12:08 | |
> No, it's the other way around. It's from cProfile which I import > profile. > > diff --git a/Lib/cProfile.py b/Lib/cProfile.py > --- a/Lib/cProfile.py > +++ b/Lib/cProfile.py > ... > +import profile as _pyprofile That's exactly what I'm saying. Once you import cProfile, the attributes on the profile functions are overriden. Either way, a module shouldn't mutate another module's functions. |
|||
| msg182281 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) | Date: 2013年02月17日 18:50 | |
Of course you're right. I didn't realize that. How about this (in attachment)? |
|||
| msg182928 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年02月25日 10:38 | |
New changeset 422169310b7c by Giampaolo Rodola' in branch 'default': Fix #17197: profile/cProfile modules refactored so that code of run() and runctx() utility functions is not duplicated in both modules. http://hg.python.org/cpython/rev/422169310b7c |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:41 | admin | set | github: 61399 |
| 2020年11月18日 19:17:46 | iritkatriel | link | issue12684 superseder |
| 2013年02月25日 10:43:23 | giampaolo.rodola | set | status: open -> closed assignee: giampaolo.rodola resolution: fixed |
| 2013年02月25日 10:38:38 | python-dev | set | nosy:
+ python-dev messages: + msg182928 |
| 2013年02月17日 18:50:04 | giampaolo.rodola | set | files:
+ profile-refactoring.diff keywords: + patch messages: + msg182281 |
| 2013年02月13日 12:08:04 | pitrou | set | messages: + msg182026 |
| 2013年02月13日 10:10:58 | giampaolo.rodola | set | messages: + msg182010 |
| 2013年02月13日 10:09:09 | pitrou | set | messages: + msg182008 |
| 2013年02月12日 22:40:35 | giampaolo.rodola | set | keywords:
+ easy, - patch components: + Library (Lib) versions: + Python 3.4 |
| 2013年02月12日 22:40:09 | giampaolo.rodola | create | |