From patchwork Mon Oct 9 19:07:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 731198 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7609DCD6127 for ; Mon, 9 Oct 2023 19:07:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346662AbjJITHo (ORCPT ); Mon, 9 Oct 2023 15:07:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346660AbjJITHo (ORCPT ); Mon, 9 Oct 2023 15:07:44 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 366B8A4 for ; Mon, 9 Oct 2023 12:07:42 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40666aa674fso46316245e9.0 for ; Mon, 09 Oct 2023 12:07:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1696878460; x=1697483260; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=wwmQKdvrDrMfRgXOywmzBm2boicgJWq4jYBe26K+/vc=; b=XNtFCdADYp5gWfQF35XtiXh2DrnqSRDXN5dJhX2f9WImaGAxof2RuFtM2bM7cyLqeV 3sHn2+6d9Rv1bRykmvhuVYRF5qBqOTlZuVjz/DKLtPLx3Etf2cQa0kWJv/2kux7sSAoO 2SwkKXGhvfLG/uhoqD4Jnz3IL+mn5RoVCaCD71jnavNfM5zqPVJueAatZi11HGIqIA3m nBtcv5Yh35L6IY4Rvz5fNocPwbPahYC/x0DfCUWqro844ADUQgqOoYZZAI0eC/zPWROi IPTZ+b7SzwWN3S0C2WV5wq3hb82aU6XSBUyJ1G2kWQTS7kXmr50p2Z9aB1d7YnAuOzNw 8vTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696878460; x=1697483260; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wwmQKdvrDrMfRgXOywmzBm2boicgJWq4jYBe26K+/vc=; b=bk165YQbQQuQwAUWovjzr4UK7/o8VxmTYTajYD0pGMslAsyTRqpZeTk83Klfurc+A1 NS1nR1PGStQrREz25IyxPllCmTV1JF4AvObb5rfDZajvggx6SjPRb02WhpUU/v6Z4KZF 0QKpZQYSaVj6XKUjpj4DvcRqNdl6sQrpIHizO7ErShyacvSHLVZ4NOCv2yqyreBpcJOG 6q+W3+e2FT01lSuieqKvffqD6fQZ8X3rBd9FtxoZC+xBEvY1Sv2UxtDXUT7QrT0jscC5 esEr6jKD2skSFoaCIOjTFsgjTE5IlX/7jomjHdCgNmJU9VEOe/hHdCNPBjBJmSAJmbMg 2Vpg== X-Gm-Message-State: AOJu0YzfD8MUp/CK9qAFJtdCcNYaLmeRyYOtaWizeGcBLqCgy8YW3WZN NO4I/Xo97iIvXYGt2f1LH+5ahg== X-Google-Smtp-Source: AGHT+IHvVS+UvuzFLmNsOIBU3IQ+Wq3Qitlt8GSM3V+YKEK5VXkkrZ/bPlLdSCaYw46rdSfXtu73pA== X-Received: by 2002:a7b:ca54:0:b0:405:3885:490a with SMTP id m20-20020a7bca54000000b004053885490amr14650651wml.0.1696878460407; Mon, 09 Oct 2023 12:07:40 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:f20d:2959:7545:e99f]) by smtp.gmail.com with ESMTPSA id k14-20020a05600c0b4e00b003fe1fe56202sm11975755wmr.33.2023.10.09.12.07.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 12:07:40 -0700 (PDT) From: Bartosz Golaszewski To: Kent Gibson , Linus Walleij , Andy Shevchenko , Viresh Kumar , Erik Schilling Cc: linux-gpio@vger.kernel.org, Bartosz Golaszewski , Phil Howard Subject: [libgpiod][PATCH] bindings: python: replace PyModule_AddObjectRef() with PyModule_AddObjectRef() Date: Mon, 9 Oct 2023 21:07:29 +0200 Message-Id: <20231009190729.38675-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org From: Bartosz Golaszewski PyModule_AddObjectRef() was added in cpython v3.10 while libgpiod claims to depend on python v3.9. Replace it with an older variant that steals the reference to the added object on success. Reported-by: Phil Howard Signed-off-by: Bartosz Golaszewski --- bindings/python/gpiod/ext/module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/python/gpiod/ext/module.c b/bindings/python/gpiod/ext/module.c index 25c252a..b456190 100644 --- a/bindings/python/gpiod/ext/module.c +++ b/bindings/python/gpiod/ext/module.c @@ -178,9 +178,9 @@ PyMODINIT_FUNC PyInit__ext(void) return NULL; } - ret = PyModule_AddObjectRef(module, "__all__", all); - Py_DECREF(all); + ret = PyModule_AddObject(module, "__all__", all); if (ret) { + Py_DECREF(all); Py_DECREF(module); return NULL; }