Skip to content

Commit dee009f

Browse files
author
nine
committed
Fixed segfault on returning Perl objects from Python space
Updated docs to reflect new co-maintainership and new known bugs git-svn-id: svn+ssh://linux/var/lib/svn/Inline-Python@2 735a7244-8e04-11dd-afe3-e3a3f23f2e30
1 parent 83b7391 commit dee009f

File tree

4 files changed

+37
-5
lines changed

4 files changed

+37
-5
lines changed

Changes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
Revision history for Perl extension Inline::Python.
22

3+
0.23 Mon Sep 29 11:50:00 CEST 2008 (Stefan Seifert)
4+
- fixed segfault when returing perl objects from python functions and methods
5+
- fixed uninitialized member variables of perl subs
6+
- updated documentation to reflect new co-maintainer
7+
38
0.22 Sun Jan 9 22:29:54 PST 2005
49
[Bug reported by David Dyck]
510
- removed some declarations after statements

Python.pod

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,8 +607,9 @@ exactly what Inline::Python itself does.
607607
This is an ALPHA release of Inline::Python. Further testing and
608608
expanded support for other operating systems and platforms will be a
609609
focus for future releases. It has been tested on RedHat Linux 6.2 with
610-
a variety of different Perl and Python configurations. Previous versions
611-
of Inline::Python working on Windows and Cygwin -- this version has never been
610+
a variety of different Perl and Python configurations. It also seems to be
611+
running pretty well on openSUSE 10.3 and 11.0. Previous versions of
612+
Inline::Python working on Windows and Cygwin -- this version has never been
612613
tested there. I strongly suspect it will require patching. Please send me
613614
patches.
614615

@@ -657,6 +658,21 @@ related to C<mymodule> or C<B> is imported, unless some Python code
657658
explicitly copies variables from the mymodule namespace into the global
658659
namespace before Perl binds to it.
659660

661+
=item 2
662+
663+
Inline::Python currently leaks a lot of memory. Basically all parameters to
664+
py_call_function and py_call_method, their return values in void context and
665+
Python objects passed into perl space. There are probably more leaks hidden
666+
somewhere. That's not much of a problem for single run scripts, but has to be
667+
kept in mind when using in long running daemons or mod_perl environments.
668+
669+
The upcoming 0.24 should fix most of these leaks, and will be released as soon
670+
as the odd segfaults get fixed that surfaced instead. (some code like
671+
destructors obviously was never run before).
672+
673+
I am very interested in reports of segfaults, leaks other than the ones
674+
described and of course testcases.
675+
660676
=back
661677

662678
=head1 AUTHOR
@@ -670,6 +686,8 @@ suggestions throughout the development of Inline::Python.
670686
Eric Wilhelm provided support for 'new-style' classes in version 0.21. Many
671687
thanks, Eric!
672688

689+
Stefan Seifert <[email protected]> fixed some bugs and is current co-maintainer.
690+
673691
=head1 COPYRIGHT
674692

675693
Copyright (c) 2001, Neil Watkiss.

README

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ INFORMATION:
5353
The Inline::Python mailing list is [email protected]. Send mail to
5454
[email protected] to subscribe.
5555

56-
Please send questions and comments to "Neil Watkiss" <[email protected]>
56+
Please send questions and comments to "Stefan Seifert" <[email protected]>
57+
58+
Copyright (c) 2000, Neil Watkiss. All Rights Reserved. This module is free software.
59+
It may be used, redistributed and/or modified under the same terms as Perl itself.
60+
61+
(see http://www.perl.com/perl/misc/Artistic.html)
5762

58-
Copyright (c) 2000, Neil Watkiss. All Rights Reserved.

perlmodule.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ static void
203203
PerlObj_dealloc(PerlObj_object *self) {
204204
Py_XDECREF(self->pkg);
205205

206-
if (self->obj) SvREFCNT_dec(self->obj);
206+
if (self->obj) sv_2mortal(self->obj); // mortal instead of DECREF. Object might be return value
207207

208208
PyMem_DEL(self);
209209
}
@@ -301,6 +301,11 @@ newPerlSub_object(PyObject *package, PyObject *sub, SV *cv) {
301301
self->pkg = package;
302302
self->full = PyString_FromString(str);
303303
}
304+
else {
305+
self->sub = NULL;
306+
self->pkg = NULL;
307+
self->full = NULL;
308+
}
304309

305310
/* we don't have to check for errors because we shouldn't have been
306311
* created unless perl_get_cv worked once.

0 commit comments

Comments
 (0)