homepage

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.

classification
Title: Exception in pstats print_callers()
Type: crash Stage:
Components: Library (Lib) Versions: Python 2.6, Python 2.5
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, matthew.fremont, stromnov, therve
Priority: normal Keywords: easy

Created on 2007年10月12日 07:14 by stromnov, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
profile.log stromnov, 2007年10月12日 07:14
1269.diff therve, 2007年11月25日 14:55
Messages (5)
msg56358 - (view) Author: Andrew Stromnov (stromnov) Date: 2007年10月12日 07:14
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pstats
>>> ps = pstats.Stats("profile.log")
>>> ps.add("profile.log")
<pstats.Stats instance at 0x01358BC0>
>>> ps.print_callers()
 Random listing order was used
{method 'append' of 'list' objects} 
 <-
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "C:\Python25\lib\pstats.py", line 388, in print_callers
 self.print_call_line(width, func, callers, "<-")
 File "C:\Python25\lib\pstats.py", line 417, in print_call_line
 nc, cc, tt, ct = value
ValueError: too many values to unpack
msg57746 - (view) Author: Matthew Fremont (matthew.fremont) Date: 2007年11月22日 00:18
I hit the same issue, and I think the problem is that at line 515 in
pstats.py add_callers() the two stats instead of adding them
member-wise. As a result, each time add() is called, the number of stats
associated with each func grows by 4. Then, when print_call_line() is
called by print_callers() or print_callees(), there are "too many values
to unpack" at line 417.
This change to pstats.py modifies add_callers() to add the stats
together instead of concatenating the tuples.
515c515
< new_callers[func] = caller + new_callers[func]
---
> new_callers[func] = map(lambda x,y: x+y, caller +
new_callers[func])
msg57789 - (view) Author: Thomas Herve (therve) * Date: 2007年11月23日 16:29
1315 is a duplicate of this, and I end up with a very similar solution.
msg57829 - (view) Author: Thomas Herve (therve) * Date: 2007年11月25日 14:55
Here's my patch against trunk, with one test. Please review!
msg61383 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008年01月21日 10:25
Committed as r60149. Thanks for the patch!
History
Date User Action Args
2022年04月11日 14:56:27adminsetgithub: 45610
2008年01月21日 10:25:13georg.brandlsetstatus: open -> closed
resolution: accepted
messages: + msg61383
2008年01月12日 01:43:20akuchlingsetkeywords: + easy
2007年11月30日 06:47:48georg.brandlsetassignee: georg.brandl
nosy: + georg.brandl
2007年11月25日 14:55:15thervesetfiles: + 1269.diff
messages: + msg57829
versions: + Python 2.6
2007年11月24日 13:37:40georg.brandllinkissue1315 superseder
2007年11月23日 16:29:02thervesetnosy: + therve
messages: + msg57789
2007年11月22日 00:18:15matthew.fremontsetnosy: + matthew.fremont
messages: + msg57746
2007年10月12日 07:14:22stromnovcreate

AltStyle によって変換されたページ (->オリジナル) /