Skip to content
This repository has been archived by the owner on Feb 21, 2025. It is now read-only.

Bump to python 3.10 #3

Merged
merged 1 commit into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

- uses: actions/setup-python@v4
with:
python-version: '3.9.13'
python-version: '3.10.10'

- id: go-cache-paths
run: |
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Go bindings for the CPython-3 C-API

**Currently supports python-3.9 only.**
**Currently supports python-3.10 only.**

This package provides a ``go`` package named "python" under which most of the
``PyXYZ`` functions and macros of the public C-API of CPython have been
Expand All @@ -24,13 +24,13 @@ This project was inspired by [`sbinet/go-python`](https://github.com/sbinet/go-p

### macOS
* Install brew
* `brew install python@3.9`
* `brew install python@3.10`
* `brew install pkg-config`

### Linux
We will need `pkg-config` and a working `python3.9` environment to build these
We will need `pkg-config` and a working `python3.10` environment to build these
bindings. Make sure you have Python libraries and header files installed as
well (`python3.9-dev` on Debian, `brew install python@3.9` on macOS, or `python3-devel` on Centos for example)..
well (`python3.10-dev` on Debian, `brew install python@3.10` on macOS, or `python3-devel` on Centos for example)..

By default `pkg-config` will look at the `python3` library so if you want to
choose a specific version just symlink `python-X.Y.pc` to `python3.pc` or use
Expand Down
8 changes: 4 additions & 4 deletions high_level_layer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Copyright 2018 Datadog, Inc.
package python3

/*
#cgo pkg-config: python-3.9-embed
#cgo pkg-config: python-3.10-embed
#include "Python.h"
*/
import "C"
Expand All @@ -17,7 +17,7 @@ import (
"unsafe"
)

//Py_Main : https://docs.python.org/3/c-api/veryhigh.html?highlight=pycompilerflags#c.Py_Main
// Py_Main : https://docs.python.org/3/c-api/veryhigh.html?highlight=pycompilerflags#c.Py_Main
// "error" will be set if we fail to call "Py_DecodeLocale" on every "args".
func Py_Main(args []string) (int, error) {
argc := C.int(len(args))
Expand All @@ -38,7 +38,7 @@ func Py_Main(args []string) (int, error) {
return int(C.Py_Main(argc, (**C.wchar_t)(unsafe.Pointer(&argv[0])))), nil
}

//PyRun_AnyFile : https://docs.python.org/3/c-api/veryhigh.html?highlight=pycompilerflags#c.PyRun_AnyFile
// PyRun_AnyFile : https://docs.python.org/3/c-api/veryhigh.html?highlight=pycompilerflags#c.PyRun_AnyFile
// "error" will be set if we fail to open "filename".
func PyRun_AnyFile(filename string) (int, error) {
cfilename := C.CString(filename)
Expand All @@ -57,7 +57,7 @@ func PyRun_AnyFile(filename string) (int, error) {
return int(C.PyRun_AnyFileFlags(cfile, cfilename, nil)), nil
}

//PyRun_SimpleString : https://docs.python.org/3/c-api/veryhigh.html?highlight=pycompilerflags#c.PyRun_SimpleString
// PyRun_SimpleString : https://docs.python.org/3/c-api/veryhigh.html?highlight=pycompilerflags#c.PyRun_SimpleString
func PyRun_SimpleString(command string) int {
ccommand := C.CString(command)
defer C.free(unsafe.Pointer(ccommand))
Expand Down