Show More
@@ -339,10 +339,12 b' static PyObject *bdiff(PyObject *self, P' | |||||
339 | struct line *al, *bl; |
|
339 | struct line *al, *bl; | |
340 | struct hunk l, *h; |
|
340 | struct hunk l, *h; | |
341 | int an, bn, len = 0, la, lb, count; |
|
341 | int an, bn, len = 0, la, lb, count; | |
|
342 | PyThreadState *_save; | |||
342 |
|
343 | |||
343 | if (!PyArg_ParseTuple(args, "s#s#:bdiff", &sa, &la, &sb, &lb)) |
|
344 | if (!PyArg_ParseTuple(args, "s#s#:bdiff", &sa, &la, &sb, &lb)) | |
344 | return NULL; |
|
345 | return NULL; | |
345 |
|
346 | |||
|
347 | _save = PyEval_SaveThread(); | |||
346 | an = splitlines(sa, la, &al); |
|
348 | an = splitlines(sa, la, &al); | |
347 | bn = splitlines(sb, lb, &bl); |
|
349 | bn = splitlines(sb, lb, &bl); | |
348 | if (!al || !bl) |
|
350 | if (!al || !bl) | |
@@ -361,6 +363,8 b' static PyObject *bdiff(PyObject *self, P' | |||||
361 | la = h->a2; |
|
363 | la = h->a2; | |
362 | lb = h->b2; |
|
364 | lb = h->b2; | |
363 | } |
|
365 | } | |
|
366 | PyEval_RestoreThread(_save); | |||
|
367 | _save = NULL; | |||
364 |
|
368 | |||
365 | result = PyBytes_FromStringAndSize(NULL, len); |
|
369 | result = PyBytes_FromStringAndSize(NULL, len); | |
366 |
|
370 | |||
@@ -385,6 +389,8 b' static PyObject *bdiff(PyObject *self, P' | |||||
385 | } |
|
389 | } | |
386 |
|
390 | |||
387 | nomem: |
|
391 | nomem: | |
|
392 | if (_save) | |||
|
393 | PyEval_RestoreThread(_save); | |||
388 | free(al); |
|
394 | free(al); | |
389 | free(bl); |
|
395 | free(bl); | |
390 | freehunks(l.next); |
|
396 | freehunks(l.next); |
General Comments 0
You need to be logged in to leave comments.
Login now