From c1eb4446161b964f1a27617778443692f162eb4b Mon Sep 17 00:00:00 2001 From: whispers Date: Tue, 7 Apr 2026 17:30:22 -0400 Subject: [PATCH] python3Packages.torch: include upstream patch for pybind11 3.0.3 pybind11 3.0.3 changes led to ambiguous deduction in some return types that used `py::make_tuple`, so the type is explicitly specified where needed. Merged pull request: https://github.com/pytorch/pytorch/pull/179277 --- .../python-modules/torch/source/default.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/development/python-modules/torch/source/default.nix b/pkgs/development/python-modules/torch/source/default.nix index cfdb32bd9df5..8a47cd27a223 100644 --- a/pkgs/development/python-modules/torch/source/default.nix +++ b/pkgs/development/python-modules/torch/source/default.nix @@ -317,6 +317,17 @@ buildPythonPackage.override { inherit stdenv; } (finalAttrs: { url = "https://github.com/pytorch/pytorch/commit/39565a7dcf8f93ea22cedeaa20088b24ff6d2634.patch"; hash = "sha256-Au5fVbs7i33d9c4Xj8koiBP7lGnsTGTaX4VlE2gAfy8="; }) + + # pybind11 3.0.3 changes led to ambiguous deduction in some return types + # that used `py::make_tuple`, so the type is explicitly specified where + # needed. + # Merged pull request: https://github.com/pytorch/pytorch/pull/179277 + # TODO: remove at the next release + (fetchpatch { + name = "pybind11-3.0.3-ambiguous-return-type.patch"; + url = "https://github.com/pytorch/pytorch/commit/b248ebc17075c0c3ad2b2532970d2ada32b2cf94.patch"; + hash = "sha256-HY5JFGNoroFsfuUOO5j6WNP6gMHWUcIJFmWLqV8PV94="; + }) ] ++ lib.optionals cudaSupport [ ./fix-cmake-cuda-toolkit.patch