[issue1269] Exception in pstats print_callers()

2008-01-21 Thread Georg Brandl

Georg Brandl added the comment:

Committed as r60149. Thanks for the patch!

--
resolution:  - accepted
status: open - closed

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1269
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1269] Exception in pstats print_callers()

2008-01-11 Thread A.M. Kuchling

Changes by A.M. Kuchling:


--
keywords: +easy

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1269
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1269] Exception in pstats print_callers()

2007-11-29 Thread Georg Brandl

Changes by Georg Brandl:


--
assignee:  - georg.brandl
nosy: +georg.brandl

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1269
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1269] Exception in pstats print_callers()

2007-11-25 Thread Thomas Herve

Thomas Herve added the comment:

Here's my patch against trunk, with one test. Please review!

--
versions: +Python 2.6
Added file: http://bugs.python.org/file8806/1269.diff

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1269
__Index: Lib/pstats.py
===
--- Lib/pstats.py   (revision 59183)
+++ Lib/pstats.py   (working copy)
@@ -512,7 +512,8 @@
 new_callers[func] = caller
 for func, caller in source.iteritems():
 if func in new_callers:
-new_callers[func] = caller + new_callers[func]
+new_callers[func] = tuple([i[0] + i[1] for i in
+   zip(caller, new_callers[func])])
 else:
 new_callers[func] = caller
 return new_callers
Index: Lib/test/test_pstats.py
===
--- Lib/test/test_pstats.py (revision 0)
+++ Lib/test/test_pstats.py (revision 0)
@@ -0,0 +1,26 @@
+import unittest
+from test import test_support
+import pstats
+
+
+
+class AddCallersTestCase(unittest.TestCase):
+Tests for pstats.add_callers helper.
+
+def test_combine_results(self):
+pstats.add_callers should combine the call results of both target
+and source by adding the call time. See issue1269.
+target = {a: (1, 2, 3, 4)}
+source = {a: (1, 2, 3, 4), b: (5, 6, 7, 8)}
+new_callers = pstats.add_callers(target, source)
+self.assertEqual(new_callers, {'a': (2, 4, 6, 8), 'b': (5, 6, 7, 8)})
+
+
+def test_main():
+test_support.run_unittest(
+AddCallersTestCase
+)
+
+
+if __name__ == __main__:
+test_main()
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1269] Exception in pstats print_callers()

2007-11-23 Thread Thomas Herve

Thomas Herve added the comment:

1315 is a duplicate of this, and I end up with a very similar solution.

--
nosy: +therve

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1269
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1269] Exception in pstats print_callers()

2007-11-21 Thread Matthew Fremont

Matthew Fremont added the comment:

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])

--
nosy: +matthew.fremont

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1269
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1269] Exception in pstats print_callers()

2007-10-12 Thread Andrew Stromnov

New submission from Andrew Stromnov:

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

--
components: Library (Lib)
files: profile.log
messages: 56358
nosy: stromnov
severity: normal
status: open
title: Exception in pstats print_callers()
type: crash
versions: Python 2.5

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1269
__

profile.log
Description: Binary data
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com