diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2016-01-30 10:33:41 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2016-01-30 10:33:41 -0500 |
commit | 2002903f2257a361ad42ab4f2e338e5212f8eaf6 (patch) | |
tree | 00848c1cebc1a4179cf80636a9bec5bd62866fc8 | |
parent | 3ef7b040af5186b2d716cdc35c9ea278504ea04a (diff) | |
download | python-coveragepy-git-2002903f2257a361ad42ab4f2e338e5212f8eaf6.tar.gz |
Clean up in the C code
-rw-r--r-- | coverage/ctracer/tracer.c | 3 | ||||
-rw-r--r-- | coverage/ctracer/util.h | 46 |
2 files changed, 23 insertions, 26 deletions
diff --git a/coverage/ctracer/tracer.c b/coverage/ctracer/tracer.c index 25036f99..681c9a97 100644 --- a/coverage/ctracer/tracer.c +++ b/coverage/ctracer/tracer.c @@ -842,7 +842,7 @@ cleanup: * PyEval_SetTrace. So sys.gettrace() will return our self parameter, which * means it must be callable to be used in sys.settrace(). * - * So we make our self callable, equivalent to invoking our trace function. + * So we make ourself callable, equivalent to invoking our trace function. * * To help with the process of replaying stored frames, this function has an * optional keyword argument: @@ -946,7 +946,6 @@ CTracer_start(CTracer *self, PyObject *args_unused) PyEval_SetTrace((Py_tracefunc)CTracer_trace, (PyObject*)self); self->started = 1; self->tracing_arcs = self->trace_arcs && PyObject_IsTrue(self->trace_arcs); - self->cur_entry.last_line = -1; /* start() returns a trace function usable with sys.settrace() */ Py_INCREF(self); diff --git a/coverage/ctracer/util.h b/coverage/ctracer/util.h index bb3ad5a3..1f536194 100644 --- a/coverage/ctracer/util.h +++ b/coverage/ctracer/util.h @@ -15,33 +15,31 @@ #if PY_MAJOR_VERSION >= 3 -#define MyText_Type PyUnicode_Type -#define MyText_AS_BYTES(o) PyUnicode_AsASCIIString(o) -#define MyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) -#define MyBytes_AS_STRING(o) PyBytes_AS_STRING(o) -#define MyText_AsString(o) PyUnicode_AsUTF8(o) -#define MyText_FromFormat PyUnicode_FromFormat -#define MyInt_FromInt(i) PyLong_FromLong((long)i) -#define MyInt_AsInt(o) (int)PyLong_AsLong(o) -#define MyText_InternFromString(s) \ - PyUnicode_InternFromString(s) - -#define MyType_HEAD_INIT PyVarObject_HEAD_INIT(NULL, 0) +#define MyText_Type PyUnicode_Type +#define MyText_AS_BYTES(o) PyUnicode_AsASCIIString(o) +#define MyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) +#define MyBytes_AS_STRING(o) PyBytes_AS_STRING(o) +#define MyText_AsString(o) PyUnicode_AsUTF8(o) +#define MyText_FromFormat PyUnicode_FromFormat +#define MyInt_FromInt(i) PyLong_FromLong((long)i) +#define MyInt_AsInt(o) (int)PyLong_AsLong(o) +#define MyText_InternFromString(s) PyUnicode_InternFromString(s) + +#define MyType_HEAD_INIT PyVarObject_HEAD_INIT(NULL, 0) #else -#define MyText_Type PyString_Type -#define MyText_AS_BYTES(o) (Py_INCREF(o), o) -#define MyBytes_GET_SIZE(o) PyString_GET_SIZE(o) -#define MyBytes_AS_STRING(o) PyString_AS_STRING(o) -#define MyText_AsString(o) PyString_AsString(o) -#define MyText_FromFormat PyUnicode_FromFormat -#define MyInt_FromInt(i) PyInt_FromLong((long)i) -#define MyInt_AsInt(o) (int)PyInt_AsLong(o) -#define MyText_InternFromString(s) \ - PyString_InternFromString(s) - -#define MyType_HEAD_INIT PyObject_HEAD_INIT(NULL) 0, +#define MyText_Type PyString_Type +#define MyText_AS_BYTES(o) (Py_INCREF(o), o) +#define MyBytes_GET_SIZE(o) PyString_GET_SIZE(o) +#define MyBytes_AS_STRING(o) PyString_AS_STRING(o) +#define MyText_AsString(o) PyString_AsString(o) +#define MyText_FromFormat PyUnicode_FromFormat +#define MyInt_FromInt(i) PyInt_FromLong((long)i) +#define MyInt_AsInt(o) (int)PyInt_AsLong(o) +#define MyText_InternFromString(s) PyString_InternFromString(s) + +#define MyType_HEAD_INIT PyObject_HEAD_INIT(NULL) 0, #endif /* Py3k */ |