diff --git a/pkgs/development/python-modules/cffi/default.nix b/pkgs/development/python-modules/cffi/default.nix index 66b315f14ab0..52b9ab08fc4d 100644 --- a/pkgs/development/python-modules/cffi/default.nix +++ b/pkgs/development/python-modules/cffi/default.nix @@ -1,5 +1,5 @@ { lib, stdenv, buildPythonPackage, isPyPy, fetchPypi, pytestCheckHook, - libffi, pkg-config, pycparser + libffi, pkg-config, pycparser, python, fetchpatch }: if isPyPy then null else buildPythonPackage rec { @@ -17,6 +17,17 @@ if isPyPy then null else buildPythonPackage rec { propagatedBuildInputs = [ pycparser ]; + patches = + # Fix test that failed because python seems to have changed the exception format in the + # final release. This patch should be included in the next version and can be removed when + # it is released. + lib.optionals (python.pythonVersion == "3.11") [ + (fetchpatch { + url = "https://foss.heptapod.net/pypy/cffi/-/commit/8a3c2c816d789639b49d3ae867213393ed7abdff.diff"; + sha256 = "sha256-3wpZeBqN4D8IP+47QDGK7qh/9Z0Ag4lAe+H0R5xCb1E="; + }) + ]; + postPatch = lib.optionalString stdenv.isDarwin '' # Remove setup.py impurities substituteInPlace setup.py \