Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2227553/?format=api
{ "id": 2227553, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2227553/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20260423222125.29097-2-vfazio@gmail.com/", "project": { "id": 42, "url": "http://patchwork.ozlabs.org/api/1.1/projects/42/?format=api", "name": "Linux GPIO development", "link_name": "linux-gpio", "list_id": "linux-gpio.vger.kernel.org", "list_email": "linux-gpio@vger.kernel.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260423222125.29097-2-vfazio@gmail.com>", "date": "2026-04-23T22:21:18", "name": "[libgpiod,v2,1/8] bindings: python: avoid PyObject_CallMethod during chip finalize", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "edde3d426bf06ad24f35aa5c2e8569e20f99b198", "submitter": { "id": 78694, "url": "http://patchwork.ozlabs.org/api/1.1/people/78694/?format=api", "name": "Vincent Fazio", "email": "vfazio@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20260423222125.29097-2-vfazio@gmail.com/mbox/", "series": [ { "id": 501257, "url": "http://patchwork.ozlabs.org/api/1.1/series/501257/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/list/?series=501257", "date": "2026-04-23T22:21:18", "name": "bindings: python: modernize C extensions", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/501257/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2227553/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2227553/checks/", "tags": {}, "headers": { "Return-Path": "\n <linux-gpio+bounces-35433-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-gpio@vger.kernel.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=ObUFvxPZ;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c15:e001:75::12fc:5321; helo=sin.lore.kernel.org;\n envelope-from=linux-gpio+bounces-35433-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"ObUFvxPZ\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.167.182", "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com" ], "Received": [ "from sin.lore.kernel.org (sin.lore.kernel.org\n [IPv6:2600:3c15:e001:75::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g1rDL631Tz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 08:21:54 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sin.lore.kernel.org (Postfix) with ESMTP id A9B7D30055D0\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 22:21:51 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id C90763537E1;\n\tThu, 23 Apr 2026 22:21:50 +0000 (UTC)", "from mail-oi1-f182.google.com (mail-oi1-f182.google.com\n [209.85.167.182])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 4FBD52EC081\n\tfor <linux-gpio@vger.kernel.org>; Thu, 23 Apr 2026 22:21:49 +0000 (UTC)", "by mail-oi1-f182.google.com with SMTP id\n 5614622812f47-463a0e14abfso3639061b6e.2\n for <linux-gpio@vger.kernel.org>;\n Thu, 23 Apr 2026 15:21:49 -0700 (PDT)", "from Zephyrus.localdomain ([131.93.209.211])\n by smtp.gmail.com with ESMTPSA id\n 586e51a60fabf-42b930afa63sm17784598fac.5.2026.04.23.15.21.47\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 23 Apr 2026 15:21:47 -0700 (PDT)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776982910; cv=none;\n b=B1UkAfH1mzuvUHpCfUAuMA9tQFG0IByui1QAE3kbKfBtFLEaJuCOmanvfQE9MDHLYfIn3X6LRQajsympr8b/tvE8BIogDTWImKwh6+HElvF6Lg5qh4CPrcRquSWts4jCuy4wk+v8ZzroA6+jF4dqEmpHQ7SGohziuFuPdD49FOA=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776982910; c=relaxed/simple;\n\tbh=mzA/Crk3gOw89p22aFb/cLw1xnD4zTkzltGXRXBSdFo=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=DeD5wjnWjq9WZdccPyTLNDIGQmrsotQhCxPf4KNj70zWhTfOIsL/zKzTpCHFxmk0yUCoE7fKwyHOc9/+RQQapuBVuIBUb9kFowuj5BWNxJ9sjk58vdl8uFDNjisaz3Ids4qPAx+wjj4aaeLXp/wQcp2gYdEGD5IsBwL9wVl/C5g=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=ObUFvxPZ; arc=none smtp.client-ip=209.85.167.182", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1776982908; x=1777587708;\n darn=vger.kernel.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=ERrsV2F90Eu+FXnm7g27tfvdZlqt7SQ8Z6LaFSOyKbQ=;\n b=ObUFvxPZ2WyoFl/XNUnHULofCanuAlq9HwgWh476vOvc0nySrSFZVHQSI85LgGPnyz\n t9R/7KNy5vKwdo52ndRpAlmfL2KpOr4xNivW7Qm2ZyKdME4XKETKccOjL7ZY2YC0tKTW\n xNpe44Rt7HFCiqTEeoY0/wwit25rNAeuOBKJejqClPlEK50xwLuJ+1c3etf/JQdb6gmX\n 1QX19RsEpQW/ADVJ2XwSb+k0muCxhpoA6J3LYjnjMZl7iw3+7HSwVIkF+GFPnMpSSz4A\n snC/zGhXj6QiLENAqjYbM4QSi8sXaydRSAbtcaNUBHS1KvPJ5ILgksaikmalaWCdyO8z\n BHzg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776982908; x=1777587708;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=ERrsV2F90Eu+FXnm7g27tfvdZlqt7SQ8Z6LaFSOyKbQ=;\n b=HmJlkKQmRxGIyqcXkbBGsSh+tD3fBTEa9qhmf/C/IeZAAZH8Ip005ZiEFNaXjSAxWu\n PNCk3NzzYmp4UWnWC/IoKb1ac+fqyI8CLKZHuKh/SpmKM1ISCultnQu+0GeW4DXAp7p2\n WsBAErtmp1s7LGkatPrDATSsIrErlhXBqiXgo8eHj/ibFQ/1IHDGjXXjAPL0ZH/JiV51\n qRF2IAphaIWhbv+41lAOxzvruu6ifIPxBAflA5Mzv6S9vZKOMAxx6EJRuCzsHklSI3mM\n W+SKB8TGtGpxmQzAy2DxHM7Kklytvseo1PpuWbB0JgN3aN8GP+lK6+e+rApqlmZlBAS+\n /r2g==", "X-Gm-Message-State": "AOJu0YxFAol7HdPBn9Oj637Bsmbs1NZnQPj1joi8vyuWoor2SjXkpOOr\n\t+gnhAVs1DKXIEjleFSFP96bqn4JTdd0JSSwdpidvLTW2yhWfdkJSeIRQdbielQ==", "X-Gm-Gg": "AeBDieuv7Nk9RlEsjwBqdH6hgDHVFAvNXGp3BTQVP6AKL3FyDaFmezZC64A5WFP4Kzt\n\tilHVH9XNLOKvVhCnrl9C+Ff5+67wB5dv3QX/mGe22dXt00VtY6xGhNl6okV8id38oHaiQSuKleJ\n\tm/dRmIf8OSRK0+JjF1Tml99APlSe1o4s4TJMYfkmyKI5pQlYy5CEEvwGZnQA8A3GbdrKROhXgWf\n\tCMlni6ZUhyR32NBexHP2ZFc1d0jOTYmJjIyctMxlJR4KiG+cwvMqJHYrlwGEXKF9LILXQc+Lv9F\n\tjGy9Auwog8Gv0RPiQe0VinwtyASFGPMQRNZlskpo9+edh2BwxwSWJnDwumje5Q/zsRpLVr7MeiR\n\tpgrCFKgbSB/Hr6kFBHbMKPkTy5wCD43kaZysqt5e3FYZtkvFUX7+AMe8I3fW0LQH8NyoHS/hAao\n\to6EOqrsJ7vUASq7wScGNEKTlkTXiaBosD5JUopH12CroWyqAPlGskWP9rLeOE/hRB+RSon0yqW", "X-Received": "by 2002:a05:6808:690b:b0:467:880:744a with SMTP id\n 5614622812f47-4799c9fd09dmr15898633b6e.24.1776982908006;\n Thu, 23 Apr 2026 15:21:48 -0700 (PDT)", "From": "Vincent Fazio <vfazio@gmail.com>", "To": "linux-gpio@vger.kernel.org", "Cc": "brgl@kernel.org,\n\tVincent Fazio <vfazio@gmail.com>", "Subject": "[libgpiod][PATCH v2 1/8] bindings: python: avoid PyObject_CallMethod\n during chip finalize", "Date": "Thu, 23 Apr 2026 17:21:18 -0500", "Message-ID": "<20260423222125.29097-2-vfazio@gmail.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20260423222125.29097-1-vfazio@gmail.com>", "References": "<20260423222125.29097-1-vfazio@gmail.com>", "Precedence": "bulk", "X-Mailing-List": "linux-gpio@vger.kernel.org", "List-Id": "<linux-gpio.vger.kernel.org>", "List-Subscribe": "<mailto:linux-gpio+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-gpio+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit" }, "content": "The PyObject_CallMethod function jumps through hoops to find the method\nto call and to build a stack (if necessary) to call a given method.\n\nIn the case of finalizing the chip object, that overhead can be avoided\nby simply sharing a function with `chip_close` to close the underlying\ngpiod_chip object.\n\nSigned-off-by: Vincent Fazio <vfazio@gmail.com>\n---\n bindings/python/gpiod/ext/chip.c | 18 ++++++++++++------\n 1 file changed, 12 insertions(+), 6 deletions(-)", "diff": "diff --git a/bindings/python/gpiod/ext/chip.c b/bindings/python/gpiod/ext/chip.c\nindex 53c4b80..be20869 100644\n--- a/bindings/python/gpiod/ext/chip.c\n+++ b/bindings/python/gpiod/ext/chip.c\n@@ -32,10 +32,19 @@ chip_init(chip_object *self, PyObject *args, PyObject *Py_UNUSED(ignored))\n \treturn 0;\n }\n \n+static void internal_chip_close(chip_object *self)\n+{\n+\tif (self->chip) {\n+\t\tPy_BEGIN_ALLOW_THREADS;\n+\t\tgpiod_chip_close(self->chip);\n+\t\tPy_END_ALLOW_THREADS;\n+\t\tself->chip = NULL;\n+\t}\n+}\n+\n static void chip_finalize(chip_object *self)\n {\n-\tif (self->chip)\n-\t\tPyObject_CallMethod((PyObject *)self, \"close\", \"\");\n+\tinternal_chip_close(self);\n }\n \n static PyObject *chip_path(chip_object *self, void *Py_UNUSED(ignored))\n@@ -62,10 +71,7 @@ static PyGetSetDef chip_getset[] = {\n \n static PyObject *chip_close(chip_object *self, PyObject *Py_UNUSED(ignored))\n {\n-\tPy_BEGIN_ALLOW_THREADS;\n-\tgpiod_chip_close(self->chip);\n-\tPy_END_ALLOW_THREADS;\n-\tself->chip = NULL;\n+\tinternal_chip_close(self);\n \n \tPy_RETURN_NONE;\n }\n", "prefixes": [ "libgpiod", "v2", "1/8" ] }