Skip to content
This repository was archived by the owner on Jul 5, 2023. It is now read-only.

Commit bd75088

Browse files
authored
Fix compilation on Python 3.8 (#119)
Two things to do this: * Use a version check (instead of a macro definedness check) to determine whether to emulate _PyObject_FastCall * Use the graminit.h versions of Py_func_type_input and friends directly instead of defining them in a compile-ast3.h, since Py_func_type_input showed back up in a public header with a different value in 3.8 and caused warnings.
1 parent 6222c24 commit bd75088

File tree

4 files changed

+5
-10
lines changed

4 files changed

+5
-10
lines changed

ast27/Custom/typed_ast.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "ast.h"
88
#include "parsetok.h"
99
#include "errcode.h"
10+
#include "graminit.h"
1011

1112
extern grammar _Ta27Parser_Grammar; /* from graminit.c */
1213

@@ -264,7 +265,7 @@ ast27_parse_impl(PyObject *source,
264265
const char *str;
265266
int compile_mode = -1;
266267
PyCompilerFlags cf;
267-
int start[] = {Py_file_input, Py_eval_input, Py_single_input /*, Py_func_type_input */};
268+
int start[] = {file_input, eval_input, single_input, func_type_input };
268269
PyObject *result;
269270

270271
cf.cf_flags = PyCF_ONLY_AST | PyCF_SOURCE_IS_UTF8;

ast3/Custom/typed_ast.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#include "Python.h"
22
#include "Python-ast.h"
3-
#include "compile-ast3.h"
43
#include "node.h"
54
#include "grammar.h"
65
#include "token.h"
76
#include "ast.h"
87
#include "parsetok.h"
98
#include "errcode.h"
9+
#include "graminit.h"
1010

1111
extern grammar _Ta3Parser_Grammar; /* from graminit.c */
1212

@@ -302,7 +302,7 @@ ast3_parse_impl(PyObject *source,
302302
const char *str;
303303
int compile_mode = -1;
304304
PyCompilerFlags cf;
305-
int start[] = {Py_file_input, Py_eval_input, Py_single_input, Py_func_type_input};
305+
int start[] = {file_input, eval_input, single_input, func_type_input};
306306
PyObject *result;
307307

308308
cf.cf_flags = PyCF_ONLY_AST | PyCF_SOURCE_IS_UTF8;

ast3/Include/compile-ast3.h

Lines changed: 0 additions & 6 deletions
This file was deleted.

ast3/Python/ast.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ typedef int bool;
1717
#define false 0
1818
#define true 1
1919

20-
#ifndef _PyObject_FastCall
20+
#if PY_MINOR_VERSION < 6
2121
static PyObject *
2222
_PyObject_FastCall(PyObject *func, PyObject *const *args, int nargs)
2323
{

0 commit comments

Comments
 (0)