1104da8
From dc850da24d4024f33ba0b04c827f36cba9674911 Mon Sep 17 00:00:00 2001
1104da8
From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= <zebob.m@gmail.com>
1104da8
Date: Mon, 27 May 2019 21:24:06 +0200
1104da8
Subject: [PATCH] Add support for positional only arguments
1104da8
MIME-Version: 1.0
1104da8
Content-Type: text/plain; charset=UTF-8
1104da8
Content-Transfer-Encoding: 8bit
1104da8
1104da8
PEP 570 adds "positional only" arguments to Python, which changes the
1104da8
code object constructor. This adds support for Python 3.8.
1104da8
1104da8
Signed-off-by: Robert-André Mauchin <zebob.m@gmail.com>
1104da8
---
1104da8
 automat/_introspection.py | 3 +++
1104da8
 1 file changed, 3 insertions(+)
1104da8
1104da8
diff --git a/automat/_introspection.py b/automat/_introspection.py
1104da8
index c7bbb8a..3f7307d 100644
1104da8
--- a/automat/_introspection.py
1104da8
+++ b/automat/_introspection.py
1104da8
@@ -13,6 +13,9 @@ def copycode(template, changes):
1104da8
     ]
1104da8
     if hasattr(code, "co_kwonlyargcount"):
1104da8
         names.insert(1, "kwonlyargcount")
1104da8
+    if hasattr(code, "co_posonlyargcount"):
1104da8
+        # PEP 570 added "positional only arguments"
1104da8
+        names.insert(1, "posonlyargcount")
1104da8
     values = [
1104da8
         changes.get(name, getattr(template, "co_" + name))
1104da8
         for name in names
1104da8
-- 
1104da8
2.21.0
1104da8