aboutsummaryrefslogtreecommitdiff
path: root/databases/py-mysqlclient
diff options
context:
space:
mode:
authorDima Panov <fluffy@FreeBSD.org>2020-03-28 12:22:18 +0000
committerDima Panov <fluffy@FreeBSD.org>2020-03-28 12:22:18 +0000
commitc6a4c59a5c9f60cac4a117604e6f67bd3e46d73b (patch)
treeaafc1e5f2c040e6ec0c16aa5c1f70cb0c54d8751 /databases/py-mysqlclient
parent9d8aecae283706d17732c0d3dc9a126451c2dbbd (diff)
downloadports-c6a4c59a5c9f60cac4a117604e6f67bd3e46d73b.tar.gz
ports-c6a4c59a5c9f60cac4a117604e6f67bd3e46d73b.zip
databases/py-mysqlclient: Add some gc safety around _mysql__fetch_row
- Users of gc.get_referrers() could cause a SystemError to be raised if this function is running in a different python thread. - While here, take maintainership Obtained from: PyMySQL repo
Notes
Notes: svn path=/head/; revision=529330
Diffstat (limited to 'databases/py-mysqlclient')
-rw-r--r--databases/py-mysqlclient/Makefile3
-rw-r--r--databases/py-mysqlclient/files/patch-gitc67dbd41f32
2 files changed, 34 insertions, 1 deletions
diff --git a/databases/py-mysqlclient/Makefile b/databases/py-mysqlclient/Makefile
index 8b2ed01967ea..1ca0c802bf27 100644
--- a/databases/py-mysqlclient/Makefile
+++ b/databases/py-mysqlclient/Makefile
@@ -2,11 +2,12 @@
PORTNAME= mysqlclient
DISTVERSION= 1.4.6
+PORTREVISION= 1
CATEGORIES= databases python
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
DISTVERSIONPREFIX= v
-MAINTAINER= ports@FreeBSD.org
+MAINTAINER= fluffy@FreeBSD.org
COMMENT= MySQL database connector for Python
LICENSE= GPLv2
diff --git a/databases/py-mysqlclient/files/patch-gitc67dbd41f b/databases/py-mysqlclient/files/patch-gitc67dbd41f
new file mode 100644
index 000000000000..bc534e2654e3
--- /dev/null
+++ b/databases/py-mysqlclient/files/patch-gitc67dbd41f
@@ -0,0 +1,32 @@
+From c67dbd41f13f5302120ad40fee94ea6c7ffc2bfc Mon Sep 17 00:00:00 2001
+From: Jason Fried <me@jasonfried.info>
+Date: Wed, 5 Feb 2020 03:38:25 -0800
+Subject: [PATCH] Add some gc safety around _mysql__fetch_row (#348)
+
+Users of gc.get_referrers() could cause a SystemError to be raised if this function is running in a different python thread.
+---
+ MySQLdb/_mysql.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/MySQLdb/_mysql.c b/MySQLdb/_mysql.c
+index 13280ac..1556fda 100644
+--- MySQLdb/_mysql.c
++++ MySQLdb/_mysql.c
+@@ -1373,9 +1373,15 @@ _mysql_ResultObject_fetch_row(
+ convert_row = row_converters[how];
+ if (maxrows) {
+ if (!(r = PyTuple_New(maxrows))) goto error;
+- rowsadded = _mysql__fetch_row(self, &r, skiprows, maxrows,
+- convert_row);
++
++ // see: https://docs.python.org/3/library/gc.html#gc.get_referrers
++ // This function can get a reference to the tuple r, and if that
++ // code is preempted while holding a ref to r, the _PyTuple_Resize
++ // will raise a SystemError because the ref count is 2.
++ PyObject_GC_UnTrack(r);
++ rowsadded = _mysql__fetch_row(self, &r, skiprows, maxrows, convert_row);
+ if (rowsadded == -1) goto error;
++ PyObject_GC_Track(r);
+ } else {
+ if (self->use) {
+ maxrows = 1000;