Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

My mother is a fish. -- William Faulkner


devel / comp.lang.python / Re: Problem slicing a list with the C API

SubjectAuthor
o Re: Problem slicing a list with the C APIJen Kris

1
Re: Problem slicing a list with the C API

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: jenkris@tutanota.com (Jen Kris)
Newsgroups: comp.lang.python
Subject: Re: Problem slicing a list with the C API
Date: Sat, 12 Mar 2022 22:54:50 +0100 (CET)
Lines: 38
Message-ID: <mailman.286.1647122092.2329.python-list@python.org>
References: <My-05ih--3-2@tutanota.com>
<CAPTjJmrXVvdm5D-AKT_sj+2Mf2CxPUzmcbWTnQv6v9xeCzy+qQ@mail.gmail.com>
<My-77V7--3-2@tutanota.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de /yv/redXjif8tPUC5QH5dQklEnpKsFJPUQO/Vb5CceSA==
Return-Path: <jenkris@tutanota.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=tutanota.com header.i=@tutanota.com header.b=gGTlIdW0;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'looks': 0.02; '2022':
0.05; 'despite': 0.05; 'parameter': 0.05; 'mar': 0.07;
'subject:API': 0.07; 'sun,': 0.07; 'cc:addr:python-list': 0.09;
'itself,': 0.09; 'subject:list': 0.11; 'url:mailman': 0.15; '(b)':
0.16; '2022,': 0.16; 'be,': 0.16; 'cc:name:python list': 0.16;
'chrisa': 0.16; 'confused': 0.16; 'context.': 0.16; 'elements.':
0.16; 'pyobject*': 0.16; 'to?': 0.16; 'wrote:': 0.16; 'problem':
0.16; 'python': 0.16; "aren't": 0.19; 'cc:addr:python.org': 0.20;
"what's": 0.22; 'skip:p 30': 0.23; 'received:de': 0.23; 'list,':
0.24; 'url-ip:188.166.95.178/32': 0.25; 'url-ip:188.166.95/24':
0.25; 'url:listinfo': 0.25; 'cc:2**0': 0.25; 'url-ip:188.166/16':
0.25; 'intend': 0.26; 'object': 0.26; 'suspect': 0.26; "isn't":
0.27; 'bit': 0.27; 'expect': 0.28; 'email addr:python.org&gt;':
0.28; 'code,': 0.31; 'url-ip:188/8': 0.31; 'fine.': 0.32; 'from,':
0.32; 'objects': 0.32; 'python-list': 0.32; 'received:192.168.1':
0.32; 'but': 0.32; "i'm": 0.33; '0);': 0.33; 'same': 0.34; 'header
:In-Reply-To:1': 0.34; 'final': 0.35; 'received:192.168': 0.37;
'list': 0.39; 'break': 0.39; 'here.': 0.61; 'simply': 0.63; 'key':
0.64; 'exactly': 0.68; 'square': 0.69; 'name,': 0.75; '(c)': 0.81;
'confirmed': 0.81; 'brackets': 0.84; 'elements,': 0.84; 'email
name:&lt;python-list': 0.84; 'touching': 0.84
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1647122090;
s=s1; d=tutanota.com;
h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:In-Reply-To:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:References:Sender;
bh=vVBdEMYWJ+CH5qNi8VBb6JPj67yy4iVIxtEr1cJizUM=;
b=gGTlIdW0OJIop0p8X0oHr7AEDR1Xpb6as9zpWxsv7zuM4BKxu9dxtXrzCbkJqHu2
6gZgncXcIvnRm7aTq3SbQYorr1+rOotpb76XAngT3S2PgzCWW+6tLP2gft/CFMO0vsv
GHr9KGZgb8l/ORTXhWqPLFq/rtufjd0mBpkMoGduuzohN994/l1PERA+6hZZpL1uPas
XTzxptKP7z9+c/i4a+xS4a1q0Opcw6ZyzexWMo0qRyMpUZOg65DMyBJUGQy6KFid5Yr
nXEvZ00AFBJAecdH97T2NT09kxxt7ONaLCok7+xRr3qI/yhUjc4zTO0di2npmgqJXw7
N/yE8FNssQ==
In-Reply-To: <CAPTjJmrXVvdm5D-AKT_sj+2Mf2CxPUzmcbWTnQv6v9xeCzy+qQ@mail.gmail.com>
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
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: <My-77V7--3-2@tutanota.com>
X-Mailman-Original-References: <My-05ih--3-2@tutanota.com>
<CAPTjJmrXVvdm5D-AKT_sj+2Mf2CxPUzmcbWTnQv6v9xeCzy+qQ@mail.gmail.com>
 by: Jen Kris - Sat, 12 Mar 2022 21:54 UTC

pDictData, despite the name, is a list of 2-tuples where each 2-tuple is a dictionary object and a string. 

Mar 12, 2022, 13:41 by rosuav@gmail.com:

> On Sun, 13 Mar 2022 at 08:25, Jen Kris via Python-list
> <python-list@python.org> wrote:
>
>> PyObject* slice = PySlice_New(PyLong_FromLong(0), half_slice, 0);
>> PyObject* subdata_a = PyObject_GetItem(pDictddata, slice);
>>
>> On the final line (subdata_a) I get a segfault. I know that the second parameter of PyObject_GetItem is a “key” and I suspect that’s where the problem comes from, but I don’t understand what a key is in this context.
>>
>
> The key is simply whatever would be in the square brackets in Python
> code, so that part looks fine.
>
> But dictionaries aren't usually subscripted with slices, so I'm a bit
> confused as to what's going on here. What exactly is
> dictdata/pDictdata?
>
> Have you confirmed that pDictdata (a) isn't NULL, (b) is the object
> you intend it to be, and (c) contains the objects you expect it to?
> The segfault might not be from the slice object itself, it might be
> from actually iterating over the thing being sliced and touching all
> its elements. For instance, if dictdata is actually a list, that call
> will be constructing a new list with references to the same elements,
> so if one of them is broken (maybe NULL), it'll break badly.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>


devel / comp.lang.python / Re: Problem slicing a list with the C API

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor