Date: Sunday, November 10, 2019 @ 08:29:46 Author: foutrelis Revision: 524935
Add two upstream Python 3.8 fixes Added: hy/trunk/python-3.8.patch Modified: hy/trunk/PKGBUILD ------------------+ PKGBUILD | 8 ++++- python-3.8.patch | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 2 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2019-11-10 08:09:52 UTC (rev 524934) +++ PKGBUILD 2019-11-10 08:29:46 UTC (rev 524935) @@ -11,12 +11,16 @@ depends=('python-rply' 'python-astor' 'python-clint' 'python-funcparserlib') makedepends=('python-setuptools') checkdepends=('python-pytest' 'python-pytest-runner') -source=("$pkgname-$pkgver.tar.gz::https://github.com/hylang/hy/archive/$pkgver.tar.gz") -md5sums=('fc719573093f14caba2fade84a8d11e9') +source=("$pkgname-$pkgver.tar.gz::https://github.com/hylang/hy/archive/$pkgver.tar.gz" + python-3.8.patch) +md5sums=('fc719573093f14caba2fade84a8d11e9' + '5f8c4d26d959168f88faaccc8b4dfb6c') prepare() { cd "$pkgname-$pkgver" + patch -Np1 -i ../python-3.8.patch + # usually generated from git metadata and aded to PyPI sdist # PyPI does not include testsuite files. echo "__version__ = '$pkgver'" > hy/version.py Added: python-3.8.patch =================================================================== --- python-3.8.patch (rev 0) +++ python-3.8.patch 2019-11-10 08:29:46 UTC (rev 524935) @@ -0,0 +1,73 @@ +From 563f27632c95d709f6685e469b7c1e97be1c38e7 Mon Sep 17 00:00:00 2001 +From: Kodi Arfer <g...@arfer.net> +Date: Tue, 4 Jun 2019 16:03:52 -0400 +Subject: [PATCH 1/2] Fix crashes on the new Python 3.8 alpha + +--- + hy/_compat.py | 4 +++- + hy/compiler.py | 3 ++- + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/hy/_compat.py b/hy/_compat.py +index a2ab7a5..da31477 100644 +--- a/hy/_compat.py ++++ b/hy/_compat.py +@@ -37,10 +37,12 @@ if PY3: + finally: + traceback = None + +- code_obj_args = ['argcount', 'kwonlyargcount', 'nlocals', 'stacksize', ++ code_obj_args = ['argcount', 'posonlyargcount', 'kwonlyargcount', 'nlocals', 'stacksize', + 'flags', 'code', 'consts', 'names', 'varnames', + 'filename', 'name', 'firstlineno', 'lnotab', 'freevars', + 'cellvars'] ++ if not PY38: ++ code_obj_args.remove("posonlyargcount") + else: + def raise_from(value, from_value=None): + raise value +diff --git a/hy/compiler.py b/hy/compiler.py +index 9a20daf..ddb75da 100755 +--- a/hy/compiler.py ++++ b/hy/compiler.py +@@ -1145,7 +1145,7 @@ class HyASTCompiler(object): + expr, + name=fname, + args=ast.arguments( +- args=[], vararg=None, kwarg=None, ++ args=[], vararg=None, kwarg=None, posonlyargs=[], + kwonlyargs=[], kw_defaults=[], defaults=[]), + body=f(parts).stmts, + decorator_list=[]) +@@ -1524,6 +1524,7 @@ class HyASTCompiler(object): + args = ast.arguments( + args=main_args, defaults=defaults, + vararg=rest, ++ posonlyargs=[], + kwonlyargs=kwonly, kw_defaults=kw_defaults, + kwarg=kwargs) + + +From 9af02dd0a4e8ffe8234e42cf834fbdcf1e12b301 Mon Sep 17 00:00:00 2001 +From: Kodi Arfer <g...@arfer.net> +Date: Mon, 10 Jun 2019 16:12:46 -0400 +Subject: [PATCH 2/2] Fix a test for Python 3.8.0b1 + +`int`, among other types, no longer has a `__str__` method, so `(str '3)` now returns "(HyInteger 3)" instead of "3". +--- + tests/native_tests/native_macros.hy | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/native_tests/native_macros.hy b/tests/native_tests/native_macros.hy +index 835939e..e320143 100644 +--- a/tests/native_tests/native_macros.hy ++++ b/tests/native_tests/native_macros.hy +@@ -391,7 +391,7 @@ in expansions." + ;; Now, let's use a `require`d macro that depends on another macro defined only + ;; in this scope. + (defmacro local-test-macro [x] +- (.format "This is the local version of `nonlocal-test-macro` returning {}!" x)) ++ (.format "This is the local version of `nonlocal-test-macro` returning {}!" (int x))) + + (assert (= "This is the local version of `nonlocal-test-macro` returning 3!" + (test-module-macro-2 3)))