473,408 Members | 1,741 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,408 software developers and data experts.

Python source sensitive to PyObject_HEAD layout?

For academic reasons, I'm hacking on the Python source trying to add
some new capabilities. At present, I'm making minor changes mostly to
familiarise myself with the code and gain awareness of what issues I
may encounter, with the result that I encountered a fairly strange one
(to me, anyway).

As I wanted to add new fields to all Python objects, it seemed to make
the most sense to add them to PyObject_HEAD. When I added an int field
to the end of PyObject_HEAD, however, the make process failed (see
below). This was on a Pentium-M running GCC 3.4.6 under Gentoo Linux. I
switched to my other computer, and Athlon 64 running GCC 4.1.0 under
Gentoo Linux, and it compiled; I dismissed the earlier failure as an
irritating but fixed GCC bug, and went on---until I added another int
field and ran into a failure at exactly the same place.

The error looks fairly uninformative, as such:

/bin/sh: line 1: 6926 Segmentation fault CC='gcc -pthread'
LDSHARED='gcc -pthread -shared' OPT='-DNDEBUG -g -O3 -Wall
-Wstrict-prototypes' ./python -E ./setup.py build
make: *** [sharedmods] Error 139

I can supply more information if desired (I ran a GDB backtrace), but
it really didn't tell me very much. None of the functions on the stack
were ones I had modified, so the only factor is the presence of that
second additional field in PyObject_HEAD (I can make it build by simply
commenting out that field and its initialiser in PyObject_HEAD_INIT).

My question is therefore a vague, nebulous, open, and at least mildly
desperate one: What is the problem? The only notion that occurs to me
is that some part of the Python source is somehow upset by alignment
issues (or padding of some sort); if so then I have no clue where that
might be. If not, then I have no idea what's causing the errors at all.

Any help, thoughts, or advice would be vastly appreciated.

--
Petter Haggholm

May 21 '06 #1
2 2084
Petter Haggholm wrote:
Any help, thoughts, or advice would be vastly appreciated.


After changing PyObject_HEAD, I would run "make distclean".
Most likely, some object files were not recompiled and still
using the old layout.

Regards,
Martin
May 22 '06 #2
Boy, do I feel foolish! I hang my head in shame and thank you for your
assistance---that solved it.

May 22 '06 #3

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

Similar topics

0
by: Nikola Milutinovic | last post by:
Hi all. I'm not subscribed to the list, so all replies to me mail directly. I ran into a small problem, for which we have found a workaround. I was compiling PostgreSQL v7.4.1 and it's...
0
by: Nikola Milutinovic | last post by:
Hi all. OS: Tru64 UNIX 4.0d PG: PostgreSQL v7.4.1 PY: Python v2.3.3 I just ran into a minor bug while compiling PL/Python module. It bombed outon lines 153 and 160 of...
2
by: ajikoe | last post by:
Hi, I tried to follow the example in swig homepage. I found error which I don't understand. I use bcc32, I already include directory where my python.h exist in bcc32.cfg. /* File : example.c...
29
by: 63q2o4i02 | last post by:
Hi, I'm interested in using python to start writing a CAD program for electrical design. I just got done reading Steven Rubin's book, I've used "real" EDA tools, and I have an MSEE, so I know what...
32
by: siggi | last post by:
@Ben Sizer Hi Ben, in January I received your message re Pygame and Python 2.5: As a Python (and programming ) newbie allow me a - certainly naive - question:
1
by: AngelBlaZe | last post by:
Can you access the c object of a python object directly? Can this be done in ctypes or directly throught python functions without reverting to forking the python module? scanario: I have pyctx...
2
by: sndive | last post by:
q#1: in C I want to check if a given PyObject is a xml.dom.minidom.Node (or a derivative). how do i extract a PyTypeObject for such a class? issue #2 I'm in a situation when i don't really...
15
by: Pie Squared | last post by:
I've been looking at the Python source code recently, more specifically trying to figure out how it's garbage collector works. I've gathered that it uses refcounting as well as some...
0
by: mathieu | last post by:
Hi there, I am currently involved in managing a large python/c++ project (using swig to automagically wrap c++ code to python). So far my current experience was that python was a second class...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.