Permalink
Browse files

BUG: Work around the inability to use <object>NULL in recent Cythons.

  • Loading branch information...
rkern committed Jun 7, 2011
1 parent d1585c2 commit 67ea608b2206d91b33237807d69bc3c6825c36db
Showing with 13 additions and 2 deletions.
  1. +4 −1 _line_profiler.pyx
  2. +1 −1 setup.py
  3. +7 −0 unset_trace.c
  4. +1 −0 unset_trace.h
View
@@ -37,6 +37,9 @@ cdef extern from "timers.h":
PY_LONG_LONG hpTimer()
double hpTimerUnit()
cdef extern from "unset_trace.h":
void unset_trace()
def label(code):
""" Return a (filename, first_lineno, func_name) tuple for a given code
@@ -158,7 +161,7 @@ cdef class LineProfiler:
def disable(self):
self.last_time = {}
PyEval_SetTrace(NULL, <object>NULL)
unset_trace()
def get_stats(self):
""" Return a LineStats object containing the timings.
View
@@ -32,7 +32,7 @@
url = 'http://packages.python.org/line_profiler',
ext_modules = [
Extension('_line_profiler',
sources=[line_profiler_source, 'timers.c'],
sources=[line_profiler_source, 'timers.c', 'unset_trace.c'],
depends=['python25.pxd'],
),
],
View
@@ -0,0 +1,7 @@
/* Hack to hide an <object>NULL from Cython. */
#include "Python.h"
void unset_trace() {
PyEval_SetTrace(NULL, NULL);
}
View
@@ -0,0 +1 @@
void unset_trace();

0 comments on commit 67ea608

Please sign in to comment.