@@ -11,15 +11,11 @@ from tokenize import generate_tokens
1111
1212from cpython.pythread cimport PyThread_get_thread_ident
1313from cpython.ref cimport PyObject
14- from cython cimport auto_pickle
15-
16- from ._tracer cimport Tracer
1714
1815from .const import SITE_PACKAGES_PATHS
1916from .const import SYS_PREFIX_PATHS
2017from .util import CYTHON_SUFFIX_RE
2118from .util import LEADING_WHITESPACE_RE
22- from .util import MISSING
2319from .util import get_func_in_mro
2420from .util import get_main_thread
2521from .util import if_same_code
@@ -45,7 +41,6 @@ cdef const PyObject** KIND_NAMES = [
4541]
4642
4743
48- @ auto_pickle (False )
4944cdef class Event:
5045 """
5146 A wrapper object for Frame objects. Instances of this are passed to your custom functions or predicates.
@@ -57,23 +52,8 @@ cdef class Event:
5752 kind (str): A string like ``'call'``, ``'line'``, ``'return'`` or ``'exception'``.
5853 arg: A value that depends on ``kind``. Usually is ``None`` but for ``'return'`` or ``'exception'`` other values
5954 may be expected.
60- tracer (:class:`hunter.tracer.Tracer`): The :class:`~hunter.tracer.Tracer` instance that created the event.
61- Needed for the ``calls`` and ``depth`` fields.
6255 """
63- def __init__ (self , FrameType frame , int kind , object arg , Tracer tracer = None , object depth = None , object calls = None ,
64- object threading_support = MISSING):
65- if tracer is None :
66- if depth is None :
67- raise TypeError (' Missing argument: depth (required because tracer was not given).' )
68- if calls is None :
69- raise TypeError (' Missing argument: calls (required because tracer was not given).' )
70- if threading_support is MISSING:
71- raise TypeError (' Missing argument: threading_support (required because tracer was not given).' )
72- else :
73- depth = tracer.depth
74- calls = tracer.calls
75- threading_support = tracer.threading_support
76-
56+ def __init__ (self , FrameType frame , int kind , object arg , int depth , int calls , bint threading_support ):
7757 self .arg = arg
7858 self .frame = frame
7959 self .kind = < str > KIND_NAMES[kind]
@@ -117,7 +97,7 @@ cdef class Event:
11797 cdef int position
11898
11999 if self ._instruction is UNSET:
120- position = PyFrame_GetLasti( < PyFrameObject * > self .frame)
100+ position = Hunter_PyFrame_GetLasti( self .frame)
121101 co_code = PyCode_GetCode(self .code_getter())
122102 if co_code and position >= 0 :
123103 self ._instruction = co_code[position]
@@ -161,7 +141,7 @@ cdef class Event:
161141 if self .builtin:
162142 self ._locals = {}
163143 else :
164- self ._locals = PyFrame_GetLocals( < PyFrameObject * > self .frame)
144+ self ._locals = Hunter_PyFrame_GetLocals( self .frame)
165145 return self ._locals
166146
167147 @property
@@ -173,7 +153,7 @@ cdef class Event:
173153 if self .builtin:
174154 self ._locals = {}
175155 else :
176- self ._globals = PyFrame_GetGlobals( < PyFrameObject * > self .frame)
156+ self ._globals = Hunter_PyFrame_GetGlobals( self .frame)
177157 return self ._globals
178158
179159 @property
@@ -266,7 +246,7 @@ cdef class Event:
266246
267247 cdef inline lineno_getter(self ):
268248 if self ._lineno is UNSET:
269- self ._lineno = PyFrame_GetLineNumber( < PyFrameObject * > self .frame)
249+ self ._lineno = Hunter_PyFrame_GetLineNumber( self .frame)
270250 return self ._lineno
271251
272252 @property
@@ -275,7 +255,7 @@ cdef class Event:
275255
276256 cdef inline CodeType code_getter(self ):
277257 if self ._code is UNSET:
278- return PyFrame_GetCode( < PyFrameObject * > self .frame)
258+ return Hunter_PyFrame_GetCode( self .frame)
279259 else :
280260 return self ._code
281261
0 commit comments