Skip to content

Commit cf2a79d

Browse files
committed
Trying a different approach to fix Python 3.13 bindings build on Windows
1 parent 1b303f6 commit cf2a79d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ jobs:
1414
- uses: actions/setup-python@v5
1515
with:
1616
python-version: ${{ matrix.python-version }}
17-
18-
- name: Install dependencies with pinned NumPy on Win/Py3.13
19-
# This step pins NumPy to a working version ONLY for the configuration
20-
# that is known to fail with numpy 2.3.0.
21-
if: matrix.os == 'windows' && matrix.python-version == '3.13'
22-
run: python -m pip install "numpy<2.3"
2317

2418
- name: Build and install
2519
run: python -m pip install .

setup.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,18 @@
2929
libraries = []
3030
extra_objects = []
3131

32+
# Add this block to define conditional compile arguments
33+
macros = []
34+
if sys.platform == 'win32' and sys.version_info >= (3, 13):
35+
print("Enabling Py_TRACE_REFS for Python 3.13+ on Windows")
36+
macros.append(('Py_TRACE_REFS', '1'))
3237

3338
ext_modules = [
3439
Extension(
3540
'hnswlib',
3641
source_files,
3742
include_dirs=include_dirs,
43+
define_macros=macros,
3844
libraries=libraries,
3945
language='c++',
4046
extra_objects=extra_objects,

0 commit comments

Comments
 (0)