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

pycxx and multiple new types



I have been using pycxx 5.2.2 to write an extension module which
defines two new types, Point and Bbox. The Bbox is constructed with 2
Point instances

class Point: public Py::PythonExtension<Point> ...

class Bbox: public Py::PythonExtension<Bbox> {
public:
Bbox(Point& ll, Point& ur) : _ll(ll), _ur(ur) {};
static void init_type(void);

// return lower left point
Py::Object ll(const Py::Tuple &args) { return Py::Object(&_ll); }

// return upper right point
Py::Object ur(const Py::Tuple &args) { return Py::Object(&_ur); }

private:
Point& _ll, _ur;
};
The problem I am having is that if I instantiate a Bbox from 2 point
instances, my python test code hangs after the last line of the script
and doesn't return the shell prompt until I hit CTRL-C.

ll = Point(10, 10)
ur = Point(20, 20)
bbox = Bbox(ll, ur) # this line causes the hang.

I think this is because I am not handling the ref count of the Point
objects properly.

My new_bbox function looks like
Py::Object _transforms_module::new_bbox (const Py::Tuple &args)
{

args.verify_length(2);

Point::check(args[0]);
Point::check(args[1]);

Point* ll = (Point*)(args[0].ptr());
Point* ur = (Point*)(args[1].ptr());
return Py::asObject(new Bbox(*ll, *ur) );
}

Do you have any thoughts on what I am doing wrong?

Thanks,
John Hunter
Jul 18 '05 #1
0 1119

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

Similar topics

2
by: Alex Rootham | last post by:
Hi, I'm quite new to schema design, and was wondering if someone might point out what I'm doing wrong when designing my Schema's I have a need to do the following: Schema1.xsd -- defines...
1
by: Steve George | last post by:
Hi, I have a scenario where I have a master schema that defines a number of complex and simple types. I then have a number of other schemas (with different namespaces) where I would like to reuse...
4
by: Leslaw Bieniasz | last post by:
Cracow, 20.09.2004 Hello, I need to implement a library containing a hierarchy of classes together with some binary operations on objects. To fix attention, let me assume that it is a...
9
by: lbj137 | last post by:
I have two files: A.c and B.c. In both files I define a global variable, int xxxx; When I compile with a green hills compiler (and also i think with a GNU compiler) I get no errors or warnings....
29
by: John Devereux | last post by:
Hi, What is the best way to ensure an integer is a multiple of a given power of 2? How about int size; ...
22
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete...
16
by: Nikolay Petrov | last post by:
How can I return multiple values from a custom function? TIA
3
by: Matt D | last post by:
I've got two web services that use the same data types and that clients will have to consume. I read the msdn article on sharing types...
0
by: vihrao | last post by:
I am designing wsdl that uses multiple schemas. I can do this in two ways: 1) use multiple schema imports in one wsdl or 2) use multiple schema imports in to one common schema and then import a...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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...

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.