Skip to content

Commit 81ede4b

Browse files
authored
Point release. (#4)
**Improvements** - Added an ASAN/UBSAN CI job that builds CPython 3.14.2 from source with AddressSanitizer and UndefinedBehaviorSanitizer, then runs the full test suite against instrumented builds of bocpy. - Updated GitHub Actions to latest versions (`actions/checkout@v6`, `actions/setup-python@v5`). - Added a Copilot skill for version bumping. **Bug Fixes** - Fixed a missing `Py_DECREF` on a temporary `PyObject` in the xidata recycling path, plugging a reference leak. - Fixed `PyMem_RawFree` freeing the wrong pointer (`xidata->obj` instead of `xidata`) in the recycling queue cleanup. Signed-off-by: Matthew A Johnson <matjoh@microsoft.com>
1 parent 67b69ac commit 81ede4b

7 files changed

Lines changed: 141 additions & 16 deletions

File tree

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
name: version-bump
3+
description: "Bump the bocpy version across all required files. Use when: incrementing the version, releasing a new version, updating version strings, preparing a release, changing the version number, or adding a changelog entry."
4+
---
5+
6+
# Version Bump
7+
8+
When asked to bump the version to a specific version (e.g. `0.3.0`), propose
9+
edits to **all** of the following files. Do not skip any.
10+
11+
## Files to Update
12+
13+
### 1. `pyproject.toml`
14+
15+
Update the `version` field under `[project]`:
16+
17+
```toml
18+
[project]
19+
name = "bocpy"
20+
version = "<NEW_VERSION>"
21+
```
22+
23+
### 2. `sphinx/source/conf.py`
24+
25+
Update the `release` variable:
26+
27+
```python
28+
release = '<NEW_VERSION>'
29+
```
30+
31+
### 3. `CITATION.cff`
32+
33+
Update both `version` and `date-released`:
34+
35+
```yaml
36+
version: <NEW_VERSION>
37+
date-released: <TODAY YYYY-MM-DD>
38+
```
39+
40+
### 4. `CHANGELOG.md`
41+
42+
Prepend a new entry **at the top** of the file with today's date, the new
43+
version, and a placeholder for the user to fill in:
44+
45+
```markdown
46+
## <TODAY YYYY-MM-DD> - Version <NEW_VERSION>
47+
TODO: Add release notes.
48+
49+
```
50+
51+
## Procedure
52+
53+
1. Read the current version from `pyproject.toml` to confirm the old value.
54+
2. Propose all four edits as a single changeset.
55+
3. Use today's date (from context) for the CHANGELOG and CITATION entries.
56+
4. Do **not** commit — the user handles git operations.

.github/workflows/pr_gate.yml

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@v4
13+
uses: actions/checkout@v6
1414

1515
- name: Use Python 3.14
1616
uses: actions/setup-python@v5
@@ -31,7 +31,7 @@ jobs:
3131
- check: src/bocpy
3232
steps:
3333
- name: Checkout
34-
uses: actions/checkout@v4
34+
uses: actions/checkout@v6
3535

3636
- name: Run clang-format style check
3737
uses: jidicula/clang-format-action@v4.8.0
@@ -47,10 +47,10 @@ jobs:
4747
python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
4848
steps:
4949
- name: Checkout
50-
uses: actions/checkout@v4
50+
uses: actions/checkout@v6
5151

5252
- name: Use Python ${{matrix.python_version}}
53-
uses: actions/setup-python@v4
53+
uses: actions/setup-python@v5
5454
with:
5555
python-version: ${{matrix.python_version}}
5656

@@ -71,10 +71,10 @@ jobs:
7171
python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
7272
steps:
7373
- name: Checkout
74-
uses: actions/checkout@v4
74+
uses: actions/checkout@v6
7575

7676
- name: Use Python ${{matrix.python_version}}
77-
uses: actions/setup-python@v4
77+
uses: actions/setup-python@v5
7878
with:
7979
python-version: ${{matrix.python_version}}
8080

@@ -95,10 +95,10 @@ jobs:
9595
python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
9696
steps:
9797
- name: Checkout
98-
uses: actions/checkout@v4
98+
uses: actions/checkout@v6
9999

100100
- name: Use Python ${{matrix.python_version}}
101-
uses: actions/setup-python@v4
101+
uses: actions/setup-python@v5
102102
with:
103103
python-version: ${{matrix.python_version}}
104104

@@ -119,10 +119,10 @@ jobs:
119119
python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
120120
steps:
121121
- name: Checkout
122-
uses: actions/checkout@v4
122+
uses: actions/checkout@v6
123123

124124
- name: Use Python ${{matrix.python_version}}
125-
uses: actions/setup-python@v4
125+
uses: actions/setup-python@v5
126126
with:
127127
python-version: ${{matrix.python_version}}
128128

@@ -134,4 +134,54 @@ jobs:
134134
run: pip install -e .[test] --verbose
135135

136136
- name: Python test
137-
run: pytest -vv
137+
run: pytest -vv
138+
139+
asan:
140+
runs-on: ubuntu-latest
141+
env:
142+
CPYTHON_VERSION: v3.14.2
143+
steps:
144+
- name: Checkout
145+
uses: actions/checkout@v6
146+
147+
- name: Install build dependencies
148+
run: |
149+
sudo apt-get update
150+
sudo apt-get install -y clang llvm build-essential pkg-config \
151+
libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev \
152+
libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev \
153+
lzma lzma-dev tk-dev uuid-dev zlib1g-dev libzstd-dev
154+
155+
- name: Download CPython ${{ env.CPYTHON_VERSION }}
156+
run: |
157+
git clone --depth 1 --branch ${{ env.CPYTHON_VERSION }} \
158+
https://github.com/python/cpython.git "$RUNNER_TEMP/cpython-src"
159+
160+
- name: Build CPython with ASAN and UBSAN
161+
working-directory: ${{ runner.temp }}/cpython-src
162+
run: |
163+
CC=clang ./configure \
164+
--with-address-sanitizer \
165+
--without-pymalloc \
166+
--with-undefined-behavior-sanitizer \
167+
--without-system-libmpdec
168+
make -j"$(nproc)"
169+
170+
- name: Create virtual environment
171+
run: |
172+
"$RUNNER_TEMP/cpython-src/python" -m venv "$RUNNER_TEMP/asan-venv"
173+
174+
- name: Build bocpy
175+
run: |
176+
source "$RUNNER_TEMP/asan-venv/bin/activate"
177+
python -m pip install --upgrade pip
178+
CC="clang -fsanitize=address,undefined -fno-sanitize=vptr" \
179+
pip install -e .[test] --verbose
180+
181+
- name: Run tests
182+
env:
183+
ASAN_OPTIONS: detect_leaks=0:halt_on_error=1
184+
UBSAN_OPTIONS: halt_on_error=1:print_stacktrace=1
185+
run: |
186+
source "$RUNNER_TEMP/asan-venv/bin/activate"
187+
pytest -vv

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
## 2026-03-17 - Version 0.2.2
2+
Point release.
3+
4+
**Improvements**
5+
- Added an ASAN/UBSAN CI job that builds CPython 3.14.2 from source with
6+
AddressSanitizer and UndefinedBehaviorSanitizer, then runs the full test suite
7+
against instrumented builds of bocpy.
8+
- Updated GitHub Actions to latest versions (`actions/checkout@v6`,
9+
`actions/setup-python@v5`).
10+
- Added a Copilot skill for version bumping.
11+
12+
**Bug Fixes**
13+
- Fixed a missing `Py_DECREF` on a temporary `PyObject` in the xidata recycling
14+
path, plugging a reference leak.
15+
- Fixed `PyMem_RawFree` freeing the wrong pointer (`xidata->obj` instead of
16+
`xidata`) in the recycling queue cleanup.
17+
118
## 2026-03-11 - Version 0.2.1
219
Point release.
320

CITATION.cff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ authors:
55
given-names: "Matthew Alastair"
66
orcid: "https://orcid.org/0000-0002-1019-8036"
77
title: "bocpy"
8-
version: 2.0.4
9-
date-released: 2026-02-11
8+
version: 0.2.2
9+
date-released: 2026-03-17
1010
url: "https://github.com/microsoft/bocpy"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "bocpy"
7-
version = "0.2.1"
7+
version = "0.2.2"
88
authors = [
99
{name = "bocpy Team", email="bocpy@microsoft.com"}
1010
]

sphinx/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
project = 'bocpy'
1515
copyright = '2026, Microsoft'
1616
author = 'Microsoft'
17-
release = '0.2.1'
17+
release = '0.2.2'
1818

1919
# -- General configuration ---------------------------------------------------
2020
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

src/bocpy/_core.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,8 @@ static void BOCRecycleQueue_recycle(BOCRecycleQueue *queue, XIDATA_T *xidata) {
969969
queue->index);
970970
}
971971

972+
Py_DECREF(xidata_ptr);
973+
972974
// manual clear
973975
if (xidata->data != NULL) {
974976
if (xidata->free != NULL) {
@@ -978,7 +980,7 @@ static void BOCRecycleQueue_recycle(BOCRecycleQueue *queue, XIDATA_T *xidata) {
978980
}
979981

980982
Py_CLEAR(xidata->obj);
981-
PyMem_RawFree(xidata->obj);
983+
PyMem_RawFree(xidata);
982984
}
983985

984986
/// @brief Enqeues an xidata on the recycling queue.

0 commit comments

Comments
 (0)