Kaydet (Commit) 9665637d authored tarafından Alexander Belopolsky's avatar Alexander Belopolsky

Merged revisions 84780-84781 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k
with some manual fixes
........
  r84780 | alexander.belopolsky | 2010-09-13 14:14:34 -0400 (Mon, 13 Sep 2010) | 3 lines

  Issue #9315: Fix for the trace module to record correct class name
  when tracing methods.  Unit tests. Patch by Eli Bendersky.
........
  r84781 | alexander.belopolsky | 2010-09-13 14:15:33 -0400 (Mon, 13 Sep 2010) | 1 line

  Removed debugging setting
........
üst 9ad66d20
This diff is collapsed.
"""This package contains modules that help testing the trace.py module. Note
that the exact location of functions in these modules is important, as trace.py
takes the real line numbers into account.
"""
"""This directory contains modules that help testing the trace.py module. Note
that the exact location of functions in these modules is important, as trace.py
takes the real line numbers into account.
"""
def func(x):
b = x + 1
return b + 2
......@@ -57,7 +57,7 @@ import threading
import time
import token
import tokenize
import types
import inspect
import gc
import pickle
......@@ -395,7 +395,7 @@ def find_lines(code, strs):
# and check the constants for references to other code objects
for c in code.co_consts:
if isinstance(c, types.CodeType):
if inspect.iscode(c):
# find another code object, so recurse into it
linenos.update(find_lines(c, strs))
return linenos
......@@ -544,7 +544,7 @@ class Trace:
## use of gc.get_referrers() was suggested by Michael Hudson
# all functions which refer to this code object
funcs = [f for f in gc.get_referrers(code)
if hasattr(f, "__doc__")]
if inspect.isfunction(f)]
# require len(func) == 1 to avoid ambiguity caused by calls to
# new.function(): "In the face of ambiguity, refuse the
# temptation to guess."
......@@ -556,17 +556,13 @@ class Trace:
if hasattr(c, "__bases__")]
if len(classes) == 1:
# ditto for new.classobj()
clsname = str(classes[0])
clsname = classes[0].__name__
# cache the result - assumption is that new.* is
# not called later to disturb this relationship
# _caller_cache could be flushed if functions in
# the new module get called.
self._caller_cache[code] = clsname
if clsname is not None:
# final hack - module name shows up in str(cls), but we've already
# computed module name, so remove it
clsname = clsname.split(".")[1:]
clsname = ".".join(clsname)
funcname = "%s.%s" % (clsname, funcname)
return filename, modulename, funcname
......
......@@ -584,6 +584,8 @@ Build
Tests
-----
- Issue #9315: Added tests for the trace module. Patch by Eli Bendersky.
- Issue #7564: Skip test_ioctl if another process is attached to /dev/tty.
- Issue #8857: Provide a test case for socket.getaddrinfo.
......@@ -1019,6 +1021,9 @@ Library
- Issue #1068268: The subprocess module now handles EINTR in internal
os.waitpid and os.read system calls where appropriate.
- Issue #9315: Fix for the trace module to record correct class name
for tracing methods.
Extension Modules
-----------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment