Loading debian/changelog +7 −0 Original line number Diff line number Diff line beancount (2.2.3-2) unstable; urgency=medium * Team upload * d/p/0003: Work around a Python3.8 bug causing a segfault (Closes: #943608) -- Pierre-Elliott Bécue <peb@debian.org> Wed, 25 Dec 2019 19:35:31 +0100 beancount (2.2.3-1) unstable; urgency=medium * Team upload. Loading debian/patches/0003-parser-Work-around-python3.8-bug-causing-a-segmentat.patch 0 → 100644 +58 −0 Original line number Diff line number Diff line From: Daniele Nicolodi <daniele@grinta.net> Date: Wed, 25 Dec 2019 19:33:55 +0100 Subject: parser: Work around python3.8 bug causing a segmentation fault See https://bugs.python.org/issue38913 --- beancount/parser/lexer.l | 4 ++-- beancount/parser/parser.c | 2 +- beancount/parser/parser.h | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/beancount/parser/lexer.l b/beancount/parser/lexer.l index afc039f..25a6235 100644 --- a/beancount/parser/lexer.l +++ b/beancount/parser/lexer.l @@ -372,7 +372,7 @@ NULL { /* Key */ [a-z][a-zA-Z0-9\-_]+: { - BUILD_LEX("KEY", "s#", yytext, yyleng-1); + BUILD_LEX("KEY", "s#", yytext, (Py_ssize_t)(yyleng-1)); unput(':'); return KEY; } @@ -533,7 +533,7 @@ void build_lexer_error(const char* string, size_t length) /* Build and accumulate a new error object. {27d1d459c5cd} */ PyObject* rv = PyObject_CallMethod(builder, "build_lexer_error", - "s#", string, length); + "s#", string, (Py_ssize_t)length); if (rv == NULL) { PyErr_SetString(PyExc_RuntimeError, "Internal error: Building exception from default rule"); diff --git a/beancount/parser/parser.c b/beancount/parser/parser.c index 4c24efd..28e9335 100644 --- a/beancount/parser/parser.c +++ b/beancount/parser/parser.c @@ -235,7 +235,7 @@ PyObject* lexer_next(PyObject *self, PyObject *args) } tokenName = getTokenName(token); - return Py_BuildValue("(sis#O)", tokenName, yylloc.first_line, yytext, yyleng, obj); + return Py_BuildValue("(sis#O)", tokenName, yylloc.first_line, yytext, (Py_ssize_t)yyleng, obj); } diff --git a/beancount/parser/parser.h b/beancount/parser/parser.h index f07b0bf..653b321 100644 --- a/beancount/parser/parser.h +++ b/beancount/parser/parser.h @@ -1,6 +1,7 @@ #ifndef BEANCOUNT_BUILDER_H #define BEANCOUNT_BUILDER_H +#define PY_SSIZE_T_CLEAN #include <Python.h> debian/patches/series +1 −0 Original line number Diff line number Diff line 0001-Remove-fonts.googleapis.com-links-for-the-bean-web-t.patch 0002-make-test_version-more-lax-to-accept-non-git-hg-vers.patch 0003-parser-Work-around-python3.8-bug-causing-a-segmentat.patch Loading
debian/changelog +7 −0 Original line number Diff line number Diff line beancount (2.2.3-2) unstable; urgency=medium * Team upload * d/p/0003: Work around a Python3.8 bug causing a segfault (Closes: #943608) -- Pierre-Elliott Bécue <peb@debian.org> Wed, 25 Dec 2019 19:35:31 +0100 beancount (2.2.3-1) unstable; urgency=medium * Team upload. Loading
debian/patches/0003-parser-Work-around-python3.8-bug-causing-a-segmentat.patch 0 → 100644 +58 −0 Original line number Diff line number Diff line From: Daniele Nicolodi <daniele@grinta.net> Date: Wed, 25 Dec 2019 19:33:55 +0100 Subject: parser: Work around python3.8 bug causing a segmentation fault See https://bugs.python.org/issue38913 --- beancount/parser/lexer.l | 4 ++-- beancount/parser/parser.c | 2 +- beancount/parser/parser.h | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/beancount/parser/lexer.l b/beancount/parser/lexer.l index afc039f..25a6235 100644 --- a/beancount/parser/lexer.l +++ b/beancount/parser/lexer.l @@ -372,7 +372,7 @@ NULL { /* Key */ [a-z][a-zA-Z0-9\-_]+: { - BUILD_LEX("KEY", "s#", yytext, yyleng-1); + BUILD_LEX("KEY", "s#", yytext, (Py_ssize_t)(yyleng-1)); unput(':'); return KEY; } @@ -533,7 +533,7 @@ void build_lexer_error(const char* string, size_t length) /* Build and accumulate a new error object. {27d1d459c5cd} */ PyObject* rv = PyObject_CallMethod(builder, "build_lexer_error", - "s#", string, length); + "s#", string, (Py_ssize_t)length); if (rv == NULL) { PyErr_SetString(PyExc_RuntimeError, "Internal error: Building exception from default rule"); diff --git a/beancount/parser/parser.c b/beancount/parser/parser.c index 4c24efd..28e9335 100644 --- a/beancount/parser/parser.c +++ b/beancount/parser/parser.c @@ -235,7 +235,7 @@ PyObject* lexer_next(PyObject *self, PyObject *args) } tokenName = getTokenName(token); - return Py_BuildValue("(sis#O)", tokenName, yylloc.first_line, yytext, yyleng, obj); + return Py_BuildValue("(sis#O)", tokenName, yylloc.first_line, yytext, (Py_ssize_t)yyleng, obj); } diff --git a/beancount/parser/parser.h b/beancount/parser/parser.h index f07b0bf..653b321 100644 --- a/beancount/parser/parser.h +++ b/beancount/parser/parser.h @@ -1,6 +1,7 @@ #ifndef BEANCOUNT_BUILDER_H #define BEANCOUNT_BUILDER_H +#define PY_SSIZE_T_CLEAN #include <Python.h>
debian/patches/series +1 −0 Original line number Diff line number Diff line 0001-Remove-fonts.googleapis.com-links-for-the-bean-web-t.patch 0002-make-test_version-more-lax-to-accept-non-git-hg-vers.patch 0003-parser-Work-around-python3.8-bug-causing-a-segmentat.patch