Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Don't hit the keys so hard, it hurts.


devel / comp.lang.python / How to make a type of a C extension compatible with mypy

SubjectAuthor
o How to make a type of a C extension compatible with mypyMarco Sulla

1
How to make a type of a C extension compatible with mypy

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

  copy mid

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

  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: How to make a type of a C extension compatible with mypy
Date: Sat, 1 Jan 2022 19:49:55 +0100
Lines: 10
Message-ID: <mailman.83.1641063042.3079.python-list@python.org>
References: <CABbU2U_jAVbRPjx5qqogs8_GiWEti4kvSfvS9X7uZPNg7MQRDw@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de OSpCpKNutMMoAQ1m0xT+SAJb4j6aLZHEOJKSG/Igh92w==
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=njePp+TS;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.023
X-Spam-Evidence: '*H*': 0.96; '*S*': 0.01; 'url-ip:140.82/16': 0.03;
'methods,': 0.09; 'received:209.85.219': 0.09; 'url:github': 0.14;
'url-ip:140/8': 0.15; 'from:name:marco sulla': 0.16;
'subject:extension': 0.16; "can't": 0.17; 'to:addr:python-list':
0.20; 'subject:How': 0.23; "doesn't": 0.32; 'message-
id:@mail.gmail.com': 0.32; 'but': 0.32; 'received:google.com':
0.34; 'from:addr:gmail.com': 0.35; 'received:209.85': 0.37;
'means': 0.38; 'received:209': 0.39; 'furthermore': 0.84;
'subject:make': 0.84; 'subject:type': 0.91
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=EXLowOr9Gwqh2vue5Cj4OFZJBf7E7UIybgA8VHPT9G4=;
b=njePp+TSPxR4WM1/9G9tmeqeZTF9UI7AVjJwjS4m3hI75YQNIVOuGP5ihaABakXeYJ
lcL2fPa7/NVqZvu1hGhwSIhvr3PVRRcnIxJh1IOVzUAou9vDhuugIEjvLOI6wzip4yEk
oQPsqi1fMkP2EQbxSF1XEHZUnPffEdEq2fuBqKqI1uHmrr8HOPWGPFczA5lmHGS77qQu
QtBNUAi67/T4eWsuGtZ5w0bbVhgezCi74TvhKuR5eGFvX5HZR8yM4q8fzM1cWFn6naLP
0oIFag5EezmBGGTz3pzIWtkQWj3WTWgDVmWP+W2NaONViSltRybYscnn3mBeG13oAjSP
Ke0Q==
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=EXLowOr9Gwqh2vue5Cj4OFZJBf7E7UIybgA8VHPT9G4=;
b=dRnripB+0LrhgG0ciavAhgM8aBBqI0RDSlVIb8i8lp1/S5+4CZJQ8qXLNKnEC2KE3J
QvABV1pFqPcbQ13X3FVWDKnPAik5OuU1/QUOUEhf3n+VDZUFX8HTdeyGX8Ord3d0tmin
6mJjlFnWdcQuhnEsRmFAcdMw8uwe8c7oQnJlQjS12aZmaW3pNL9/mAxMfBbeWZSkv/VR
JU0B06mFdUogmMu44G5CGmBR5O0nG3X0sRnclKDSHlJa1KMS7F7+Y2VQilLAeCM8REO8
FtKAC50yhzn7KKO++PiZjmTbZGITKS0Y0i1EbjRvP8fo+Wlqv4Nk3EIFvT+Nep/l5KJX
z09g==
X-Gm-Message-State: AOAM531NlVKnI2REeGEtbkGzfSricGhCbqy1ewV5ZO7+1LE+NCJ+yVhl
vYNr69E99hfz2a0bf+VnFbtuZbxw4i6BmLFnaorOEhBwMpI=
X-Google-Smtp-Source: ABdhPJwizHiZaZYNJrG5wXcSgaFxxJJ+xnQrQrT7RMTTnSAHuqSzD7sSrBpP4Tz6CWqPfBG8AS5gndAnb5jS5D8jfZU=
X-Received: by 2002:a25:6f0a:: with SMTP id k10mr36226680ybc.536.1641063031596;
Sat, 01 Jan 2022 10:50:31 -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: <CABbU2U_jAVbRPjx5qqogs8_GiWEti4kvSfvS9X7uZPNg7MQRDw@mail.gmail.com>
 by: Marco Sulla - Sat, 1 Jan 2022 18:49 UTC

I created a type in a C extension, that is an immutable dict. If I do:

a: mydict[str, str]

it works. But it doesn't work with mypy, as signalled to me by an user:

https://github.com/Marco-Sulla/python-frozendict/issues/39

How can I make it work? I don't know what he means with annotating
methods, and furthermore I suppose I can't do this in C.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor