Skip to content

Commit 0dd3d29

Browse files
committed
update comments for py_limited_api compatibility
1 parent 156bb4b commit 0dd3d29

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020

2121
library_name = "extension_cpp"
2222

23-
# Configure Py_LIMITED_API based on PyTorch version
23+
# NOTE: PyTorch versions < 2.6 use torch.extension.h which depends on pybind11,
24+
# and pybind11 requires full access to Python's C API (including internal
25+
# structures like PyObject). This makes it incompatible with Py_LIMITED_API
26+
# which restricts access to only stable Python C API symbols.
27+
# For Py_LIMITED_API compatibility, use torch.library.h instead (PyTorch 2.6+).
2428
if torch.__version__ >= "2.6.0":
2529
py_limited_api = True
2630
else:

0 commit comments

Comments
 (0)