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


Groups > comp.lang.python > #107459

How are you supposed to define subclasses in C?

Path csiph.com!news.swapon.de!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!not-for-mail
From Random832 <random832@fastmail.com>
Newsgroups comp.lang.python
Subject How are you supposed to define subclasses in C?
Date Thu, 21 Apr 2016 12:35:56 -0400
Lines 7
Message-ID <mailman.20.1461256559.23626.python-list@python.org> (permalink)
References <1461256556.38223.585724489.051B2155@webmail.messagingengine.com>
Mime-Version 1.0
Content-Type text/plain
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de lLeN7IICTYqkAbggaGRj7gfIpsRAJGuvTPnaP8V0gY7w==
Return-Path <random832@fastmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'sys': 0.05; 'subject:How': 0.09; 'received:internal': 0.09; 'assume': 0.11; '...)': 0.16; 'descriptors': 0.16; 'message-id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'subject:subclasses': 0.16; 'module,': 0.18; 'trying': 0.22; 'tried': 0.24; 'examples': 0.24; 'skip:" 20': 0.26; 'figure': 0.27; '(e.g.': 0.27; 'define': 0.27; 'skip:p 30': 0.35; 'but': 0.36; 'instead': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'received:10': 0.37; 'received:66': 0.38; 'skip:p 20': 0.38; 'to:addr:python.org': 0.40; 'header:Message-Id:1': 0.61; 'subject:you': 0.85
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=DyB u+wBOwTJ4NLZ3Av16KFwBfpw=; b=K/pqCE8wte5LcZEtFlz7S2f/38pGJnmn1Rp cXZ5/tSF5Zp2VnJeTM+3I/VeQOlnZM90UC6CC7qcTBquMJ44XPFYHYNywlBnW8rg BFEztIPLmHL8osPpZ4kH3pyeO/WbJXnC3prQTxzI/vVuesNPxwmbpvXyo783zruo pqJMN0OE=
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=DyBu+wBOwTJ4NLZ3Av16KFwBfpw=; b=tXjTS qN16TMTxc92OvDuUtHfAaM2YcY9IvwZuaXhd2u0x8UlNnSJCBYN82evCfcSMnaA6 jk9zOKUJ8BD5jjOhIa3+62wp7siyYpu4fp8sSx0UCSmBpDCk3VxWI04T8N4Pp4ij 0bSZ4ZG5LqQzswddsHxkW4A7TW+OID1eNPqhi8=
X-Sasl-Enc AONgOyCeHi7xQ+2fDzW0hVGSd3QjA1RN+rnkYzvxZSKA 1461256556
X-Mailer MessagingEngine.com Webmail Interface - ajax-71fd8077
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 <1461256556.38223.585724489.051B2155@webmail.messagingengine.com>
Xref csiph.com comp.lang.python:107459

Show key headers only | View raw


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.

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


Thread

How are you supposed to define subclasses in C? Random832 <random832@fastmail.com> - 2016-04-21 12:35 -0400

csiph-web