diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1da03c460..81094ecb1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,8 @@ jobs: compiler: 'g++' - os: ubuntu-latest python-version: '3.11' + - os: ubuntu-latest + python-version: '3.12' steps: - uses: actions/checkout@v3 @@ -37,6 +39,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true - name: Install/Upgrade Python dependencies run: python -m pip install --upgrade pip wheel 'setuptools>=60.2' @@ -61,7 +64,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.11', '3.10', '3.9', '3.8'] + python-version: ['3.12', '3.11', '3.10', '3.9', '3.8'] steps: - uses: actions/checkout@v3 @@ -102,6 +105,8 @@ jobs: python-version: '3.9' - os: ubuntu-latest python-version: '3.11' + - os: ubuntu-latest + python-version: '3.12' steps: - uses: actions/checkout@v3 @@ -117,6 +122,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true - name: Install/Upgrade Python dependencies run: python -m pip install --upgrade pip wheel diff --git a/docs/quickstart.rst b/docs/quickstart.rst index b526552e7..f57063cfa 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -4,14 +4,17 @@ HPy Quickstart This section shows how to quickly get started with HPy by creating a simple HPy extension from scratch. -Install HPy: +Install latest HPy release: -.. - This should be updated to pip install hpy once this version is released +.. code-block:: console + + python3 -m pip install hpy + +Alternatively, you can also install HPy from the development repository: .. code-block:: console - python3 -m pip install git+https://github.com/hpyproject/hpy.git#egg=hpy.universal + python3 -m pip install git+https://github.com/hpyproject/hpy.git#egg=hpy Create a new directory for the new HPy extension. Location and name of the directory do not matter. Add the following two files: diff --git a/hpy/debug/src/debug_ctx.c b/hpy/debug/src/debug_ctx.c index fbcb0b21e..1f021daa5 100644 --- a/hpy/debug/src/debug_ctx.c +++ b/hpy/debug/src/debug_ctx.c @@ -559,7 +559,7 @@ const char *debug_ctx_Type_GetName(HPyContext *dctx, DHPy type) ctx_info->is_valid = false; const char *name = HPyType_GetName(uctx, uh_type); ctx_info->is_valid = true; - n_name = strlen(name); + n_name = strlen(name) + 1; return (const char *)protect_and_associate_data_ptr(type, (void *)name, n_name); } diff --git a/hpy/devel/src/runtime/structseq.c b/hpy/devel/src/runtime/structseq.c index 8feb27d6f..9acd23775 100644 --- a/hpy/devel/src/runtime/structseq.c +++ b/hpy/devel/src/runtime/structseq.c @@ -224,7 +224,15 @@ HPyStructSequence_New(HPyContext *ctx, HPy type, HPy_ssize_t nargs, HPy *args) tp = (PyTypeObject *)_h2py(type); name = PyUnicode_FromStringAndSize(s_n_fields, sizeof(s_n_fields)); // CPython also accesses the dict directly - v = PyDict_GetItemWithError(tp->tp_dict, name); +#if PY_VERSION_HEX >= 0x030C0000 + PyObject *dict = PyType_GetDict(tp); +#else + PyObject *dict = tp->tp_dict; +#endif + v = PyDict_GetItemWithError(dict, name); +#if PY_VERSION_HEX >= 0x030C0000 + Py_DECREF(dict); +#endif Py_DECREF(name); if (v == NULL && !PyErr_Occurred()) { goto type_error;