Blob Blame History Raw
From 91cc49153c2618b33c8ff36e12bb68d3ce61d3ee Mon Sep 17 00:00:00 2001
From: Thomas A Caswell <tcaswell@gmail.com>
Date: Sun, 10 Nov 2019 18:42:54 -0500
Subject: [PATCH] FIX: build on cpython master branch

https://github.com/python/cpython/pull/16013
https://github.com/python/cpython/commit/3a4f66707e824ef3a8384827590ebaa6ca463dc0

removed two arguments from _PyBytes_DecodeEscape .

This calls _PyBytes_DecodeEscape with the new signature if the minor
version is 9 or greater.
---
 ast3/Python/ast.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ast3/Python/ast.c b/ast3/Python/ast.c
index 9082329..d772a83 100644
--- a/ast3/Python/ast.c
+++ b/ast3/Python/ast.c
@@ -4531,8 +4531,14 @@ decode_bytes_with_escapes(struct compiling *c, const node *n, const char *s,
                           size_t len)
 {
     const char *first_invalid_escape;
+
+    #if PY_MINOR_VERSION < 9
     PyObject *result = _PyBytes_DecodeEscape(s, len, NULL, 0, NULL,
                                              &first_invalid_escape);
+    #else
+    PyObject *result = _PyBytes_DecodeEscape(s, len, NULL,
+                                             &first_invalid_escape);
+    #endif
     if (result == NULL)
         return NULL;