473,406 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Py_TPFLAGS_HEAPTYPE, what's its real meaning ?

Hi all,

I've got problems with the Py_TPFLAGS_HEAPTYPE and the new
'hackcheck' in python 2.3.

I'm writing a C-extension module for python 2.3.
I need to declare a new class, MyClass.
For this class I want two things :
1) redefine the setattr function on objects of this class
(ie setting a new tp_setattro)
2) I want that the python user can change attributes on MyClass (the
class itself).

Now I have a conflict on the Py_TPFLAGS_HEAPTYPE with new Python 2.3.
If I have Py_TPFLAGS_HEAPTYPE set on MyClass, I'll have problem with the
new hackcheck (Object/typeobject.c:3631), as I am a HEAPTYPE but I also
redefine tp_setattro.
If I don't have Py_TPFLAGS_HEAPTYPE, the user can't set new attributes on
my class because of a check in type_setattro (Object/typeobject.c:2047).

The only solution I've got without modifying python source is to create
a specific Metaclass for Myclass, and write the tp_setattr.
But I don't like the idea of making a copy-paste of the type_setattr
source code, just to remove a check, this is not great for future
compatibility with python (at each revision of Python I have to check if
type_setattr has not change to copy-paste the changes).
In fact I'm really wondering what's the real meaning of this flags, but
I think there is some history behind it.
Boris
Jul 18 '05 #1
0 1360

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Li Daobing | last post by:
Hello, Does anyone know what's the meaning of Dutch in "The Zen of Python"? Thanks in advance Li Daobing The Zen of Python, by Tim Peters
3
by: Roman Simkin | last post by:
Hi, As far as I know, a static variable is a variable that belongs to a function or a class (are there any other options?). I've seen somewhere a function that *returns* static types - something...
9
by: Qiao Jian | last post by:
I am new to c. Today I just read an h file within which there is statements: #ifndef _RANDOM_H #define _RANDOM_H So what is the meaning or purpose of this statement? When should I use such...
7
by: KevinLee | last post by:
I found that the STL.NET published with VS Beta2, but what is the meaning of STL.NET. Is it just a simple wrapper to replace the old std stl? I can find nothing new but the keyword 'Generate' to...
2
by: Jimmy | last post by:
The following is apart of db2diag file. 2006-10-11-19.03.36.005000 Instance:DB2 Node:000 PID:3440(tomcat5.exe) TID:844 Appid:none oper system services sqloSSemClose Probe:20 ...
11
by: sam | last post by:
What is the meaning of this operator:- => Please tell about this.
5
by: nas | last post by:
Hi..Please tell me what is the meaning of these lines static IFastString *(*pfnlr)(const char *)=0 and IFastString *(**ppfn)(const char *)=pfnlr Where IFastString is the abstract class
5
by: =?Utf-8?B?Sm9seW5pY2U=?= | last post by:
Hi everyone, I am learning c# and i donĀ“t understand a piece of code , can anyone explain the meaning of this code please. public class vector { public double? R = null; //I suppose this...
2
by: James | last post by:
In output of comand "db2pd -d <dbname-tcbstats index", what's the meaning of IID=0? Please advise. Thanks so much. James
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.