[implement python code in C] can't set attributes of built-in/extension type
From: Andrew Degtiariov (ad_at_astral-on.net)
Date: 09/17/04
- Next message: Michael Foord: "Re: HTTP - basic authentication example."
- Previous message: phansen: "Re: Need script to download file at known address"
- Next in thread: Michael Hudson: "Re: [implement python code in C] can't set attributes of built-in/extension type"
- Reply: Michael Hudson: "Re: [implement python code in C] can't set attributes of built-in/extension type"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 17 Sep 2004 15:14:43 +0300 (EEST)
Hello!
I tried to rewrite my python module in C. My module is successfully
imported but i can't assing anything to class attributes (tp_setattr in
PyTypeObject for class FlowReportRow filled up by pointer to
FlowReportRowObjectSetAttr function and printf in ones show the function does
not called)
Where I was mistaken? (you may see the module sources at
http://astral.ua/~ad/Report.c)
I wrote simple test:
import Reports
row = Reports.FlowReportRow
print dir(row)
row.show_local_ip = 1
And it displays:
ad@odin:share>python test.py
['__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', 'add', 'add2']
Traceback (most recent call last):
File "test.py", line 6, in ?
row.show_local_ip = 1
TypeError: can't set attributes of built-in/extension type
'FlowReportRow'
ad@odin:share>
-- Andrew Degtiariov DA-RIPE
- Next message: Michael Foord: "Re: HTTP - basic authentication example."
- Previous message: phansen: "Re: Need script to download file at known address"
- Next in thread: Michael Hudson: "Re: [implement python code in C] can't set attributes of built-in/extension type"
- Reply: Michael Hudson: "Re: [implement python code in C] can't set attributes of built-in/extension type"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]