python: line_profiler: fix build with Python 3.7

_line_profiler.c has to be regenerated by Cython.

I did not use fetchpatch because this patch does not have a stable source.
This commit is contained in:
Orivej Desh 2019-07-14 19:00:36 +00:00
parent 8671386768
commit 161927b1b1
2 changed files with 43 additions and 1 deletions

View File

@ -16,12 +16,18 @@ buildPythonPackage rec {
sha256 = "efa66e9e3045aa7cb1dd4bf0106e07dec9f80bc781a993fbaf8162a36c20af5c"; sha256 = "efa66e9e3045aa7cb1dd4bf0106e07dec9f80bc781a993fbaf8162a36c20af5c";
}; };
patches = [ ./python37.patch ];
buildInputs = [ cython ]; buildInputs = [ cython ];
propagatedBuildInputs = [ ipython ]; propagatedBuildInputs = [ ipython ];
disabled = isPyPy; disabled = isPyPy;
preBuild = ''
rm -f _line_profiler.c
'';
checkPhase = '' checkPhase = ''
${python.interpreter} -m unittest discover -s tests ${python.interpreter} -m unittest discover -s tests
''; '';
@ -32,4 +38,4 @@ buildPythonPackage rec {
license = lib.licenses.bsd3; license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ fridh ]; maintainers = with lib.maintainers; [ fridh ];
}; };
} }

View File

@ -0,0 +1,36 @@
From 542baf59f3b2eada13bde48e8a89e484c2cfeeef Mon Sep 17 00:00:00 2001
From: Hanaasagi <ambiguous404@gmail.com>
Date: Wed, 17 Apr 2019 06:46:03 +0000
Subject: [PATCH] Support Python 3.7 Generator (PEP 479)
---
kernprof.py | 2 ++
line_profiler.py | 2 ++
2 files changed, 4 insertions(+)
diff --git a/kernprof.py b/kernprof.py
index 108d36e..6461cf6 100755
--- a/kernprof.py
+++ b/kernprof.py
@@ -102,6 +102,8 @@ def wrapper(*args, **kwds):
self.enable_by_count()
try:
item = g.send(input)
+ except StopIteration:
+ return
finally:
self.disable_by_count()
input = (yield item)
diff --git a/line_profiler.py b/line_profiler.py
index a481dd2..5744d05 100755
--- a/line_profiler.py
+++ b/line_profiler.py
@@ -100,6 +100,8 @@ def wrapper(*args, **kwds):
self.enable_by_count()
try:
item = g.send(input)
+ except StopIteration:
+ return
finally:
self.disable_by_count()
input = (yield item)