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

Need help with strange segfault

I am attempting to get a working wrapper around the TransactionSet
class from the rpm module but I am getting unexplained segfaults
in /usr/bin/python.

The reason why I am working on a wrapper is that I want to have a
single RPM abstraction module which is thread-safe and does not tie up
the RPM database. So here is my wrapper class:

class Transaction:
def __init__ (self, db=None):
self.ts = None
self.ts_lock = Lock ()
self.db = db
self.func = None

# This method will acquire the lock, record the TransactionSet
# method being called by the caller and return the pointer to
# the call_ts_func () function, which will do all the work.
def __getattr__ (self, name):
self.ts_lock.acquire ()
self.func = name
return self.call_ts_func

# This method serves as a wrapper around the actual TransactionSet
# method being called. It will open the database, call the
# TransactionSet method, close the databse, and then release the
# lock acquired in the __getattr__ () function.
def call_ts_func (self, *args):
if not self.ts:
if self.db: rpm.addMacro ("_dbpath", self.db)
self.ts = rpm.TransactionSet ()
self.ts.openDB ()
if self.db: rpm.delMacro ("_dbpath")

func = self.ts.__getattribute__ (self.func)
rs = func (*args)

self.func = None
self.ts.clean ()
self.ts.closeDB ()
del self.ts
self.ts = None
self.ts_lock.release ()
return rs

I am getting what appears to be a correct value in rs but as soon as I
try to access it from the caller function, Python segfaults.

Any help would be appreciated?

Mitko Haralanov mi***@qlogic.com
Senior Software Engineer 650.934.8064
System Interconnect Group http://www.qlogic.com

Any programming language is at its best before it is implemented and
Sep 5 '07 #1
0 880

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

Similar topics

by: Robert Frunzke | last post by:
Hello, I'm developing a php extension as a communication layer for a proprietary database. Now, when I run two different versions of this extension on the same webserver (Apache 3, PHP 4.3.3,...
by: devesh.agrawal | last post by:
Hi , this program does a segfault in g++3.2 onwards , works with g++2.95 , Any ideas are welcome , basically there is this instruction when compiled with -S option , call *%eax , where the one...
by: Ovid | last post by:
Hi all, I'm having a problem trying to create a 2D array whose dimensions are determined at runtime. Below my signoff is a minimal test case that hopefully demonstrates what I'm trying to do. ...
by: Code Raptor | last post by:
Folks, I am hitting a segfault while free()ing allocated memory - to make it short, I have a linked list, which I try to free node-by-node. While free()ing the 28th node (of total 40), I hit a...
by: Eric Lilja | last post by:
Hello, I have two code snippets I want you to look at. My program compiles without warnings (warning level set to max, gcc 3.4.3) with either snippet but the latter one causes a segfault at...
by: James Daughtry | last post by:
char array; scanf("%19s", &array); I know this is wrong because it's a type mismatch, where scanf expects a pointer to char and gets a pointer to an array of 20 char. I know that question 6.12...
by: FBM | last post by:
Hi, I am working on a program that simulates one of the elements of ATM. The simulation stores events which occurs every some milliseconds for a certain amount of time. Every time that an event...
by: ptq2238 | last post by:
Hi, I'm getting confused with arrays and hope someone can shed light on my code. I wrote this to try and learn about files and arrays as I thought if I could grab each element and place them into...
by: Miles Lubin | last post by:
I am using PyArg_ParseTuple to parse the arguments (ignoring the keyword arguments) to my initproc for a type I define. It seems that something goes wrong inside PyArg_ParseTuple when it gets the...
by: DiAvOl | last post by:
Hello everyone, Please take a look at the following code: #include <stdio.h> typedef struct person { char name; int age; } Person;
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.