Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Base 8 is just like base 10, if you are missing two fingers. -- Tom Lehrer


devel / comp.lang.python / Re: How to support annotations for a custom type in a C extension?

SubjectAuthor
o Re: How to support annotations for a custom type in a C extension?MRAB

1
Re: How to support annotations for a custom type in a C extension?

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: python@mrabarnett.plus.com (MRAB)
Newsgroups: comp.lang.python
Subject: Re: How to support annotations for a custom type in a C extension?
Date: Sun, 19 Sep 2021 03:59:31 +0100
Lines: 21
Message-ID: <mailman.744.1632020381.4164.python-list@python.org>
References: <CABbU2U-XzTKOW2MfbYnEQKDKj9pMfZ8PAHrjLDX__e2FsHFp5w@mail.gmail.com>
<74a8da49-6966-62e1-d481-db350b69bed2@mrabarnett.plus.com>
<si4vf7$12b9$1@ciao.gmane.io>
<0638d578-f322-0b59-3af5-3d0927c1eeb2@mrabarnett.plus.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de +Tczos4nj+roTFEK9RFQoACObJ70Y0qKq5jCVyP8SEDw==
Return-Path: <python@mrabarnett.plus.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=plus.com header.i=@plus.com header.b=Guft4yc9;
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.026
X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'pep': 0.07;
'from:addr:python': 0.09; 'received:192.168.1.64': 0.09; 'bugs.':
0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab':
0.16; 'message-id:@mrabarnett.plus.com': 0.16;
'received:plus.net': 0.16; 'slot': 0.16; 'slot.': 0.16; 'static':
0.16; 'subject:extension': 0.16;
'\xd0\xbf\xd0\xb8\xd1\x88\xd0\xb5:': 0.16; 'wrote:': 0.16; 'says':
0.17; 'instead': 0.17; 'to:addr:python-list': 0.20; 'skip:_ 10':
0.22; 'subject:How': 0.23; 'actual': 0.25; 'skip:{ 20': 0.26;
'header:User-Agent:1': 0.30; 'received:192.168.1': 0.32;
'subject:for': 0.33; 'there': 0.33; 'header:In-Reply-To:1': 0.34;
'using': 0.37; "it's": 0.37; 'class': 0.37; 'received:192.168':
0.37; 'use': 0.39; 'should': 0.40; 'method': 0.61; 'received:212':
0.62; 'subject:support': 0.64; 'right': 0.68; 'prohibit': 0.69;
'reasons': 0.84; 'casting': 0.84; 'type.': 0.84; 'subject:type':
0.91; 'was,': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019;
t=1632020374; bh=h5sbZ09gCrm6GkGpS7NU7kWUTVyn7m3clb6aSKoAxug=;
h=Subject:To:References:From:Date:In-Reply-To;
b=Guft4yc9ieghyEZxNpG26ctmtUXp8MuuA7jSWjl7CTRY6lwbd+vxFj7KdsXlAGYmR
SJumEzUyQ6oPAAxSuh8mb4VCJIsgAL1vBSOrlme41dGy44d2t24xSPcaRoim1G6kgv
lHA6uJVRz0q3CuVTXI06W8m9Sr53DPF0GmhLdj++pTjTkbTHEgrMFrAv4b+ywVYfqg
TJ0+My5UEFJgGjdKokpzmKYSww5ztyX5cI8skQENXiBAy3LZtP190p6tGnz5czuOoQ
nD1LxTKmoBR01Ul8dfB8CwHdSHm2zHtxnWOf+SjJfIVTIXeHSBEbVPJpe16YjKRDfE
p+rABjH6CVdQA==
X-Clacks-Overhead: "GNU Terry Pratchett"
X-CM-Score: 0.00
X-CNFS-Analysis: v=2.3 cv=FKGAO9gs c=1 sm=1 tr=0
a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17
a=MvupoK3IZagj-0fD:21 a=IkcTkHD0fZMA:10 a=Vbnxw8laU50R-M6qJlQA:9
a=QEXdDO2ut3YA:10 a=zTbg-grOEVuUhkVg8dVe:22
X-AUTH: mrabarnett@:2500
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
In-Reply-To: <si4vf7$12b9$1@ciao.gmane.io>
Content-Language: en-GB
X-CMAE-Envelope: MS4wfN1bSxAOs17SF8O3xxCPPoVGefxVpDkT7mP0j0l49fZl1zBKi6HQmNENEs+A9qansW+SmPN01ZCrpDuObcg2pzan2DTRt3fkt9QRPfDTTxgqzVpgvAcP
aAHEzmoDd3Wt1L63IeGldCVJHUpdpIZjlqirZ+JApe4exFwsSuqk4IElMJmCHdwEvqkVZj/br4fpCw==
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
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: <0638d578-f322-0b59-3af5-3d0927c1eeb2@mrabarnett.plus.com>
X-Mailman-Original-References: <CABbU2U-XzTKOW2MfbYnEQKDKj9pMfZ8PAHrjLDX__e2FsHFp5w@mail.gmail.com>
<74a8da49-6966-62e1-d481-db350b69bed2@mrabarnett.plus.com>
<si4vf7$12b9$1@ciao.gmane.io>
 by: MRAB - Sun, 19 Sep 2021 02:59 UTC

On 2021-09-18 16:09, Serhiy Storchaka wrote:
> 18.09.21 03:54, MRAB пише:
>> static PyMethodDef customdict_methods[] = {
>> ...
>>     {"__class_getitem__", (PyCFunction)Py_GenericAlias, METH_CLASS |
>> METH_O | METH_COEXIST, PyDoc_STR("See PEP 585")},
>> ...
>> };
>>
>>
>> Note the flags: METH_CLASS says that it's a class method and
>> METH_COEXIST says that it should use this method instead of the slot.
>
> "(PyCFunction)" is redundant, Py_GenericAlias already has the right
> type. Overuse of casting to PyCFunction can hide actual bugs.
>
I borrowed that from listobject.c, which does have the cast.

> METH_COEXIST is not needed. There is no slot for __class_getitem__, and
> even if it was, there would be no reasons to prohibit using it.
>


devel / comp.lang.python / Re: How to support annotations for a custom type in a C extension?

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor