Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #107460

Re: How are you supposed to define subclasses in C?

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Zachary Ware <zachary.ware+pylist@gmail.com>
Newsgroups comp.lang.python
Subject Re: How are you supposed to define subclasses in C?
Date Thu, 21 Apr 2016 11:39:09 -0500
Lines 13
Sender zachary.ware@gmail.com
Message-ID <mailman.21.1461256772.23626.python-list@python.org> (permalink)
References <1461256556.38223.585724489.051B2155@webmail.messagingengine.com> <CAKJDb-M6G9hW-XO+7am_Em+45cavgJV_b8ZkYjDEV7GuZMryeg@mail.gmail.com>
Reply-To python-list@python.org
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de G7UVnfhfBQmPamcHGcOibARNZHlwdw9xiFExN3WPFdJA==
Return-Path <zachary.ware@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'sys': 0.05; '21,': 0.07; 'subject:How': 0.09; 'received:209.85.218': 0.10; 'assume': 0.11; 'thu,': 0.15; '...)': 0.16; '2016': 0.16; 'descriptors': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:subclasses': 0.16; 'wrote:': 0.16; 'sender:addr:gmail.com': 0.18; 'module,': 0.18; 'url:default': 0.18; 'to:name:python-list@python.org': 0.20; 'trying': 0.22; 'am,': 0.23; 'tried': 0.24; 'examples': 0.24; 'header:In-Reply- To:1': 0.24; 'skip:" 20': 0.26; 'figure': 0.27; '(e.g.': 0.27; 'define': 0.27; 'message-id:@mail.gmail.com': 0.27; 'url:python': 0.33; 'received:google.com': 0.35; 'skip:p 30': 0.35; 'but': 0.36; 'instead': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:209': 0.38; 'skip:p 20': 0.38; 'to:addr:python.org': 0.40; 'header:Reply-To:1': 0.67; 'reply- to:no real name:2**0': 0.71; 'url:c': 0.76; 'reply- to:addr:python.org': 0.84; 'url:cpython': 0.84; 'subject:you': 0.85
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:from:date :message-id:subject:to; bh=o26ihE0tx9exVucd0OJqcWib/0FCMIh31G9CM6vx55w=; b=aiEGItA8/eaMF6W3tmZz1npaSEKwFw11r10alCXc39IFB/HgYP3ZQjph8EbjQxDcmD Wm3ka74/AggBdR6mihUyZ58sDoROkNXswfVRgtzTV6jNQl0Rjb6ylpnGOpgel7Nagr15 hw49L1+a6hMFeGu2e2uKSq7oelq15LpfqAQ8m/08Eb6iXVylYWpUsfZMIYm6JqNvojPF Z8uhipsGjTB4N/zVzDtRse+WHHV//olOJCt9Adza6XydhaAC3+KfMyQu+XDPHpcZ+bI6 n8oXMfWDyvOHLJu084AJOUYQYO2QL8efbTfdnTUWJFr6aCBBbqUevxdEW9U8kfZha3zq kYTQ==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:sender:in-reply-to :references:from:date:message-id:subject:to; bh=o26ihE0tx9exVucd0OJqcWib/0FCMIh31G9CM6vx55w=; b=WyzL0+v90SEAh55jhMwsB8uT57clVEepm+yCsSlS4BoCM6g2poeOtJpjpKPT6Bb0fF q8rYPC4zOMzRQoJmaMjhspF2qy69YChPdSHJhLhsQ9aKUfGxKRu6ItHwupeq4go9bl1P WMYoQxd5HYnFPTNTFUNEbwJBcKpcY7rfpBzDH9PdFw/amlGfMYEGjaVfvnhfkdK4aip+ 6ArpHvNzQUYDa5mmiWz6e9mQTYFh31w3iEfWBnxoLXN19HcNtefxjf5G4ZTHdoqwLX1Y zdUVyzaHQ+w4qGhOM0moToia35PbOF2k6jvjCgrFOCBiuHYvLmdPfjS2H9QOz7Zyxyg3 cmMg==
X-Gm-Message-State AOPr4FVri2JWV+MFX2MVKq2hLq7Nvh1KvYW5wZTvHS7o55+mKwpIzGn2B/Y1o786EP4YwucOaLa81M5rYc7NgQ==
X-Received by 10.202.61.85 with SMTP id k82mr6534066oia.114.1461256769195; Thu, 21 Apr 2016 09:39:29 -0700 (PDT)
In-Reply-To <1461256556.38223.585724489.051B2155@webmail.messagingengine.com>
X-Google-Sender-Auth JkwEDUA9qF2dBFbXjdStoBTI83g
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
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 <http://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 <CAKJDb-M6G9hW-XO+7am_Em+45cavgJV_b8ZkYjDEV7GuZMryeg@mail.gmail.com>
X-Mailman-Original-References <1461256556.38223.585724489.051B2155@webmail.messagingengine.com>
Xref csiph.com comp.lang.python:107460

Show key headers only | View raw


On Thu, Apr 21, 2016 at 11:35 AM, Random832 <random832@fastmail.com> wrote:
> I was trying to write a proof of concept on including descriptors (e.g.
> a "sys.recursionlimit" instead of set/get methods) in the sys module,
> and couldn't figure out how to "properly" define a type using
> PyType_FromSpecWithBases. Everything I tried just segfaulted. I ended up
> just calling PyObject_CallFunctionObjArgs((PyObject *)&PyType_Type, ...)
> but I assume there's a better way to do it. I couldn't find any examples
> or tutorial.

Have a look at https://hg.python.org/cpython/file/default/Modules/xxsubtype.c

-- 
Zach

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: How are you supposed to define subclasses in C? Zachary Ware <zachary.ware+pylist@gmail.com> - 2016-04-21 11:39 -0500

csiph-web