diff --git a/src/runtime/python/README.md b/src/runtime/python/README.md index 504a5c529..4ffd9cca4 100644 --- a/src/runtime/python/README.md +++ b/src/runtime/python/README.md @@ -1,5 +1,9 @@ # Python bindings to C runtime +## Compatibility + +These bindings do not support Python 2. Python 3 is assumed in all these instructions. + ## Pre-requisites 1. You must have installed the PGF C runtime (see `../c/README.md`) @@ -26,10 +30,3 @@ pytest ``` Requires: `pip install pytest` - - -## Debugging - -valgrind --leak-check=full --show-leak-kinds=all pytest 2> valgrind.txt - -valgrind --leak-check=full --show-leak-kinds=all -- python -c 'import pgf; s = pgf.readType("A -> B"); print(s)' 2> valgrind.txt diff --git a/src/runtime/python/expr.h b/src/runtime/python/expr.h index 0fa1e90ea..e9d11d677 100644 --- a/src/runtime/python/expr.h +++ b/src/runtime/python/expr.h @@ -13,7 +13,7 @@ typedef struct { PyObject *exprs; // PyTupleObject of ExprObject } TypeObject; -PyTypeObject pgf_TypeType; +extern PyTypeObject pgf_TypeType; // typedef struct { // PyObject_HEAD @@ -72,14 +72,14 @@ typedef struct { ExprObject *expr; } ExprImplArgObject; -PyTypeObject pgf_ExprType; -PyTypeObject pgf_ExprAbsType; -PyTypeObject pgf_ExprAppType; -PyTypeObject pgf_ExprLitType; -PyTypeObject pgf_ExprMetaType; -PyTypeObject pgf_ExprFunType; -PyTypeObject pgf_ExprVarType; -PyTypeObject pgf_ExprTypedType; -PyTypeObject pgf_ExprImplArgType; +extern PyTypeObject pgf_ExprType; +extern PyTypeObject pgf_ExprAbsType; +extern PyTypeObject pgf_ExprAppType; +extern PyTypeObject pgf_ExprLitType; +extern PyTypeObject pgf_ExprMetaType; +extern PyTypeObject pgf_ExprFunType; +extern PyTypeObject pgf_ExprVarType; +extern PyTypeObject pgf_ExprTypedType; +extern PyTypeObject pgf_ExprImplArgType; #endif // PYPGF_EXPR_H_ diff --git a/src/runtime/python/ffi.h b/src/runtime/python/ffi.h index 1d3ca3f25..823f2ff71 100644 --- a/src/runtime/python/ffi.h +++ b/src/runtime/python/ffi.h @@ -12,7 +12,7 @@ typedef struct { PgfRevision revision; } PGFObject; -PyObject *PGFError; +extern PyObject *PGFError; PgfExnType handleError(PgfExn err); PgfText *CString_AsPgfText(const char *s, size_t size); @@ -29,7 +29,7 @@ void FreePgfText(PgfText *txt); void FreeHypos(PgfTypeHypo *hypos, Py_ssize_t n_hypos); void FreePgfPrintContext(PgfPrintContext *ctxt); -PgfUnmarshaller unmarshaller; -PgfMarshaller marshaller; +extern PgfUnmarshaller unmarshaller; +extern PgfMarshaller marshaller; #endif // PYPGF_FFI_H_ diff --git a/src/runtime/python/transactions.h b/src/runtime/python/transactions.h index af70d5e29..61e3692e7 100644 --- a/src/runtime/python/transactions.h +++ b/src/runtime/python/transactions.h @@ -12,7 +12,7 @@ typedef struct { PgfRevision revision; // transient branch } TransactionObject; -PyTypeObject pgf_TransactionType; +extern PyTypeObject pgf_TransactionType; PyObject *PGF_checkoutBranch(PGFObject *self, PyObject *args);