Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Machines that have broken down will work perfectly when the repairman arrives.


devel / comp.lang.python / Cpython: when to incref before insertdict

SubjectAuthor
o Cpython: when to incref before insertdictMarco Sulla

1
Cpython: when to incref before insertdict

<mailman.187.1646490090.2329.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=17375&group=comp.lang.python#17375

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: Marco.Su...@gmail.com (Marco Sulla)
Newsgroups: comp.lang.python
Subject: Cpython: when to incref before insertdict
Date: Sat, 5 Mar 2022 15:20:51 +0100
Lines: 7
Message-ID: <mailman.187.1646490090.2329.python-list@python.org>
References: <CABbU2U8d9scJo8pMaynoW25jmT-ipJc9DMfbEy2ccmEsr1GK7w@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de DGsPRLk47wQESh4h4JvnHwTjbiHguKtEAUpCSUWtsWwg==
Return-Path: <elbarbun@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=E/ry6N7/;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.046
X-Spam-Evidence: '*H*': 0.92; '*S*': 0.01; 'subject:when': 0.07;
'received:209.85.219': 0.09; 'call,': 0.16; 'from:name:marco
sulla': 0.16; 'functions,': 0.16; 'to:addr:python-list': 0.20;
'skip:_ 10': 0.22; 'before.': 0.31; 'message-id:@mail.gmail.com':
0.32; 'received:google.com': 0.34; 'from:addr:gmail.com': 0.35;
'functions': 0.36; 'received:209.85': 0.37; 'received:209': 0.39;
'key': 0.64; 'subject:before': 0.93
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=mime-version:from:date:message-id:subject:to;
bh=kq1EFNbqxRwFwlzDTX7UJUHbClnkeThmhrVllsRFFPk=;
b=E/ry6N7/NntciJbuTl5pKKGh3p+iyhREkcGVt5ro3IYtnCQrYFqStu3dzwWwD4DXCJ
XJe4uuEUuxUvqTyLtcyjn0Wb9qZW5q8K1bi1Rue3wJC3gvAgpJdqoJC9B+dFjatZWZyK
IbmGU6XlzClyDBr6sJudJOhKez70s7V1/rcyH4o9l1FH6KnHqFWO+D+c1/agZeK/nvoI
Y3k222EcUhfPjYeUUYQxAbgEBM9iT35W/HG7VCE4qdhjROo5lrPUbrUmm0htKArgm6SZ
x4hdp6EwpyTkzv6NWlH6FDY+w0np4lgRUQCOZTsKVtDe5VKENIwvD5vt9s8Q0MCwCSVq
pHQA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
bh=kq1EFNbqxRwFwlzDTX7UJUHbClnkeThmhrVllsRFFPk=;
b=Q8aTsNejC49pzaUZkfZcI0xqgYSjglFRq8VcMIk8ShTShCFTlK4RvPKItoXesl+JAw
IMs3LGFWDqaeGxtZoLyMYzC+3N3yRpnUOoaHKpFsJD/JHXVNKoAEuKD8w7Y7J748I+pf
dDE2pExT76W4OTdcTYfxivMkVu8fTLwj1tPrmJJcFEsPmGsphUSuiu1R8FtIEnC8NWOx
L6RSIZADDAuOvRNMPtKhME3O1D8DHHOFC8e4C5SYKx8zccD/K7c5aFOoLchaISQ6pYTh
pEuBwEkTxow/U77uwOHImUCAuAiRt3xPXOU9QdJyrvMmcSG5GTtNkAndziX9PBpWoBFf
ZpLA==
X-Gm-Message-State: AOAM531d/WouNU/5O6CfT/wzETFcwfuaq1KBeMWbjq0PYCBjKtjqZXEQ
PKQxFcVIBj+b2F4FGrbf4rxLANKUB9JdgCMUmgvZJeIZQtw=
X-Google-Smtp-Source: ABdhPJzQUGLG9Ndj1R9X2uWR4MT6HicqiY1/pniQOMQkmk8DQZEjzBaGuUKimGWXPF5NnKNM13qujw/7H/z7neNeSOw=
X-Received: by 2002:a25:dec2:0:b0:61d:e09e:94d1 with SMTP id
v185-20020a25dec2000000b0061de09e94d1mr2455721ybg.287.1646490087629; Sat, 05
Mar 2022 06:21:27 -0800 (PST)
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CABbU2U8d9scJo8pMaynoW25jmT-ipJc9DMfbEy2ccmEsr1GK7w@mail.gmail.com>
 by: Marco Sulla - Sat, 5 Mar 2022 14:20 UTC

I noticed that some functions inside dictobject.c that call insertdict
or PyDict_SetItem do an incref of key and value before the call, and a
decref after it. An example is dict_merge. Other functions, such as
_PyDict_FromKeys, don't do an incref before.

When an incref of key and value is needed before insertdict and when
is not? And why is an incref needed?

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor