From astaley at berkeley.edu Fri Feb 6 12:18:19 2009 From: astaley at berkeley.edu (Aaron Staley) Date: Fri, 06 Feb 2009 03:18:19 -0800 Subject: [capi-sig] Python segfaulting on exit Message-ID: <498C1C7B.2060605@berkeley.edu> Recently (I suspect after I upgraded to Ubuntu Intrepid), python has been segfaulting whenever it exits AND my Cpp extension has been importing. The exact error (from valgrind is): ==11326== Process terminating with default action of signal 11 (SIGSEGV) ==11326== Access not within mapped region at address 0x40 ==11326== at 0x5BAF974: (within /lib/libselinux.so.1) ==11326== by 0x5BA8B8D: (within /lib/libselinux.so.1) ==11326== by 0x5BA11D7: (within /lib/libselinux.so.1) ==11326== by 0x5BB134F: (within /lib/libselinux.so.1) ==11326== by 0x400E152: (within /lib/ld-2.8.90.so) ==11326== by 0x40B6D68: exit (in /lib/tls/i686/cmov/libc-2.8.90.so) ==11326== by 0x80ED204: handle_system_exit (pythonrun.c:1620) ==11326== by 0x80ED3FC: PyErr_PrintEx (pythonrun.c:1064) ==11326== by 0x80ED661: PyErr_Print (pythonrun.c:978) ==11326== by 0x80EDC87: PyRun_InteractiveOneFlags (pythonrun.c:795) ==11326== by 0x80EDDB7: PyRun_InteractiveLoopFlags (pythonrun.c:723) ==11326== by 0x80EE515: PyRun_AnyFileExFlags (pythonrun.c:692) Has anyone seen this before? This is not a showstopper for me, but it is a bit annoying. Thanks, Aaron From mal at egenix.com Fri Feb 6 13:00:46 2009 From: mal at egenix.com (M.-A. Lemburg) Date: Fri, 06 Feb 2009 13:00:46 +0100 Subject: [capi-sig] Python segfaulting on exit In-Reply-To: <498C1C7B.2060605@berkeley.edu> References: <498C1C7B.2060605@berkeley.edu> Message-ID: <498C266E.1060209@egenix.com> On 2009-02-06 12:18, Aaron Staley wrote: > Recently (I suspect after I upgraded to Ubuntu Intrepid), python has > been segfaulting whenever it exits AND my Cpp extension has been importing. > > The exact error (from valgrind is): > > ==11326== Process terminating with default action of signal 11 (SIGSEGV) > ==11326== Access not within mapped region at address 0x40 > ==11326== at 0x5BAF974: (within /lib/libselinux.so.1) > ==11326== by 0x5BA8B8D: (within /lib/libselinux.so.1) > ==11326== by 0x5BA11D7: (within /lib/libselinux.so.1) > ==11326== by 0x5BB134F: (within /lib/libselinux.so.1) > ==11326== by 0x400E152: (within /lib/ld-2.8.90.so) > ==11326== by 0x40B6D68: exit (in /lib/tls/i686/cmov/libc-2.8.90.so) > ==11326== by 0x80ED204: handle_system_exit (pythonrun.c:1620) > ==11326== by 0x80ED3FC: PyErr_PrintEx (pythonrun.c:1064) > ==11326== by 0x80ED661: PyErr_Print (pythonrun.c:978) > ==11326== by 0x80EDC87: PyRun_InteractiveOneFlags (pythonrun.c:795) > ==11326== by 0x80EDDB7: PyRun_InteractiveLoopFlags (pythonrun.c:723) > ==11326== by 0x80EE515: PyRun_AnyFileExFlags (pythonrun.c:692) > > > Has anyone seen this before? This is not a showstopper for me, but it is > a bit annoying. This typically happens in case of a refcount bug in your extension. Python finalizes all modules before exiting and during the course of this, clears all module dictionaries. It's also possible that the cleanup process triggers an exception which cannot be handled properly anymore during exit due to a half-gone Python interpreter system. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Feb 06 2009) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try our new mxODBC.Connect Python Database Interface for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ From astaley at berkeley.edu Sat Feb 7 04:09:48 2009 From: astaley at berkeley.edu (Aaron Staley) Date: Fri, 06 Feb 2009 19:09:48 -0800 Subject: [capi-sig] Python segfaulting on exit In-Reply-To: <498C266E.1060209@egenix.com> References: <498C1C7B.2060605@berkeley.edu> <498C266E.1060209@egenix.com> Message-ID: <498CFB7C.4090000@berkeley.edu> M.-A. Lemburg wrote: > On 2009-02-06 12:18, Aaron Staley wrote: > >> Recently (I suspect after I upgraded to Ubuntu Intrepid), python has >> been segfaulting whenever it exits AND my Cpp extension has been importing. >> >> The exact error (from valgrind is): >> >> ==11326== Process terminating with default action of signal 11 (SIGSEGV) >> ==11326== Access not within mapped region at address 0x40 >> ==11326== at 0x5BAF974: (within /lib/libselinux.so.1) >> ==11326== by 0x5BA8B8D: (within /lib/libselinux.so.1) >> ==11326== by 0x5BA11D7: (within /lib/libselinux.so.1) >> ==11326== by 0x5BB134F: (within /lib/libselinux.so.1) >> ==11326== by 0x400E152: (within /lib/ld-2.8.90.so) >> ==11326== by 0x40B6D68: exit (in /lib/tls/i686/cmov/libc-2.8.90.so) >> ==11326== by 0x80ED204: handle_system_exit (pythonrun.c:1620) >> ==11326== by 0x80ED3FC: PyErr_PrintEx (pythonrun.c:1064) >> ==11326== by 0x80ED661: PyErr_Print (pythonrun.c:978) >> ==11326== by 0x80EDC87: PyRun_InteractiveOneFlags (pythonrun.c:795) >> ==11326== by 0x80EDDB7: PyRun_InteractiveLoopFlags (pythonrun.c:723) >> ==11326== by 0x80EE515: PyRun_AnyFileExFlags (pythonrun.c:692) >> >> >> Has anyone seen this before? This is not a showstopper for me, but it is >> a bit annoying. >> > > This typically happens in case of a refcount bug in your extension. > Python finalizes all modules before exiting and during the course > of this, clears all module dictionaries. > > It's also possible that the cleanup process triggers an exception > which cannot be handled properly anymore during exit due to a > half-gone Python interpreter system. > > Thanks for the tips. I actually forgot to mention that just importing the extension will trigger the crashing behavior when I exit; I do not even need to call module functions. Correct me if I'm wrong, but it doesn't seem that a module import should be affecting any reference counts. I should note that my module is linking to shared libraries (namely opencv) when linked; has this been known to have issues? From philip at semanchuk.com Thu Feb 12 15:19:57 2009 From: philip at semanchuk.com (Philip Semanchuk) Date: Thu, 12 Feb 2009 09:19:57 -0500 Subject: [capi-sig] Correct use of PyTuple_Pack? Message-ID: <7280B7AC-F07D-4DD9-8C30-9AB2C82A7942@semanchuk.com> Hi all, I'm trying to make sure I'm using PyTuple_Pack() correctly. This code leaks references, yes? return PyTuple_Pack(2, PyString_FromString("some string"), PyInt_FromLong(42)); And this is the correct way to do it, yes? py_msg = PyString_FromString("some string"); py_type = PyInt_FromLong(42); py_return_tuple = PyTuple_Pack(2, py_msg, py_type); Py_DECREF(py_msg); Py_DECREF(py_type); return py_return_tuple; Thanks for the confirmation Philip From hniksic at xemacs.org Thu Feb 12 23:14:47 2009 From: hniksic at xemacs.org (Hrvoje Niksic) Date: Thu, 12 Feb 2009 23:14:47 +0100 Subject: [capi-sig] Correct use of PyTuple_Pack? In-Reply-To: <7280B7AC-F07D-4DD9-8C30-9AB2C82A7942@semanchuk.com> (Philip Semanchuk's message of "Thu\, 12 Feb 2009 09\:19\:57 -0500") References: <7280B7AC-F07D-4DD9-8C30-9AB2C82A7942@semanchuk.com> Message-ID: <87zlgri9pk.fsf@mulj.homelinux.net> Philip Semanchuk writes: > I'm trying to make sure I'm using PyTuple_Pack() correctly. > > This code leaks references, yes? > > return PyTuple_Pack(2, PyString_FromString("some string"), > PyInt_FromLong(42)); > > And this is the correct way to do it, yes? > > py_msg = PyString_FromString("some string"); > py_type = PyInt_FromLong(42); > > py_return_tuple = PyTuple_Pack(2, py_msg, py_type); > > Py_DECREF(py_msg); > Py_DECREF(py_type); > > return py_return_tuple; Yes, and yes. Note that you can use Py_BuildValue to create a new tuple and steal the new references: return Py_BuildValue("NN", PyString_FromString("some string"), PyInt_FromLong(42)); From philip at semanchuk.com Fri Feb 13 03:12:10 2009 From: philip at semanchuk.com (Philip Semanchuk) Date: Thu, 12 Feb 2009 21:12:10 -0500 Subject: [capi-sig] Correct use of PyTuple_Pack? In-Reply-To: <87zlgri9pk.fsf@mulj.homelinux.net> References: <7280B7AC-F07D-4DD9-8C30-9AB2C82A7942@semanchuk.com> <87zlgri9pk.fsf@mulj.homelinux.net> Message-ID: <26725768-B455-4B97-9574-51403245273F@semanchuk.com> On Feb 12, 2009, at 5:14 PM, Hrvoje Niksic wrote: > Philip Semanchuk writes: > >> I'm trying to make sure I'm using PyTuple_Pack() correctly. >> >> This code leaks references, yes? >> >> return PyTuple_Pack(2, PyString_FromString("some string"), >> PyInt_FromLong(42)); >> >> And this is the correct way to do it, yes? >> >> py_msg = PyString_FromString("some string"); >> py_type = PyInt_FromLong(42); >> >> py_return_tuple = PyTuple_Pack(2, py_msg, py_type); >> >> Py_DECREF(py_msg); >> Py_DECREF(py_type); >> >> return py_return_tuple; > > Yes, and yes. Note that you can use Py_BuildValue to create a new > tuple and steal the new references: > > return Py_BuildValue("NN", PyString_FromString("some string"), > PyInt_FromLong(42)); I much prefer your version. Thanks. From ahmadsoso2009 at hotmail.com Mon Feb 16 17:37:57 2009 From: ahmadsoso2009 at hotmail.com (Ahmad eko) Date: Mon, 16 Feb 2009 19:37:57 +0300 Subject: [capi-sig] difficultiest to find installing blender and other support program Message-ID: Dear Support Python. I have around to find best rendering and was find blender as well as other rendering product, that galery of blender it so realistict and excited to install. I have install blender new 2.48a, and I install to python 2.5.2 (I dont know if I install newest is python 3.1 it will work or not.) I have the problem to complite python documentation server at http://localhost:7464/ install like this....which I must put from many list this? and then what I must fill it python command line??? "help", "copyright" or "license" for more information>>> and then I find plone new releases 3. 2. 1 after install that plone not shown on all program. it mean all this install just complite for blender right? Please I am really new and excited to learn and study much about rendering by blender. Also I have blog to collect my rendering job, would like to get from blender gallery and show on my blog. would like you don't mind and having information the best rendering of blender gallery artist community. Thank you for your guide and having best solution of blender rendering. Best Regards Ahmad Eko _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ From snakeru at gmail.com Mon Feb 16 19:14:09 2009 From: snakeru at gmail.com (Alexey Nezhdanov) Date: Mon, 16 Feb 2009 21:14:09 +0300 Subject: [capi-sig] difficultiest to find installing blender and other support program In-Reply-To: References: Message-ID: <200902162114.09791.snakeru@gmail.com> Dear Ahmad. First of all - this list is for C<=>Python interaction, not for general questions. Next - I can't understand what you wanted to achieve and what your problem was. It seems that you've installed python but didn't manage to install documentation server (which implies that you are on win32 platform and you forgot to mention that - too bad). Please find maillist that is related to 'just python install' or better yet - to blender support as you are clearly targeting it as your destination application. When you'll be asking question there first describe your system as detailed as you can. Not just that it is win32 and you are using python2.5.2. Then describe your problem - what you want to achieve. Then describe what you got instead - everything with maximum detail possible of course. Googling for 'how to ask questions' may be also helpful - there are some good docs around On Monday 16 February 2009 19:37:57 Ahmad eko wrote: > Dear Support Python. > > I have around to find best rendering and was find blender as well as other > rendering product, that galery of blender it so realistict and excited to > install. I have install blender new 2.48a, and I install to python 2.5.2 > (I dont know if I install newest is python 3.1 it will work or not.) I have > the problem to complite python documentation server at > http://localhost:7464/ install like this....which I must put from many > list this? and then what I must fill it python command line??? "help", > "copyright" or "license" for more information>>> > > and then I find plone new releases 3. 2. 1 after install that plone not > shown on all program. it mean all this install just complite for blender > right? > Please I am really new and excited to learn and study much about rendering > by blender. > > Also I have blog to collect my rendering job, would like to get from > blender gallery and show on my blog. would like you don't mind and having > information the best rendering of blender gallery artist community. Thank > you for your guide and having best solution of blender rendering. > > Best Regards > Ahmad Eko > > > > _________________________________________________________________ > Express yourself instantly with MSN Messenger! Download today it's FREE! > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ > _______________________________________________ > capi-sig mailing list > capi-sig at python.org > http://mail.python.org/mailman/listinfo/capi-sig -- Sincerely yours Alexey Nezhdanov From ideasman42 at gmail.com Fri Feb 20 04:24:27 2009 From: ideasman42 at gmail.com (Campbell Barton) Date: Thu, 19 Feb 2009 19:24:27 -0800 Subject: [capi-sig] Garbage output from warnings with embedded python Message-ID: <7c1ab96d0902191924p1811021cie9c24f6d27457879@mail.gmail.com> Recently I wanted to deprecate some functions in our the C api, and found that warnings give weired output when running through through our C api. A simple test is to do this... print range(1.5) When I run this from python I get good output.. test.py:1: DeprecationWarning: integer argument expected, got float print range(1.5) But when running from our C api I get /home/ideasman42/blender-svn/blender/blender.bin:1: DeprecationWarning: integer argument expected, got float ELF?p40?"4()&44?4?44?4?????F??F??F?K ?K ?<@G?K ?K xxHH?H? P?td?2???C ??C L,L,Q?td/lib/ld-linux.so.2GNU????8?1LQ ?U?N?.yH {??d I thought this was todo with running a compiled string so I tried PyRun_String() on the text buffer instead of PyEval_EvalCode() but the same problem. Id be interested to know if anyones embedded python gives proper warnings. On Linux testing with python 2.6 here. -- - Campbell From khughes at pacific.edu Fri Feb 20 04:35:03 2009 From: khughes at pacific.edu (Ken Hughes) Date: Thu, 19 Feb 2009 19:35:03 -0800 Subject: [capi-sig] Garbage output from warnings with embedded python In-Reply-To: <7c1ab96d0902191924p1811021cie9c24f6d27457879@mail.gmail.com> References: <7c1ab96d0902191924p1811021cie9c24f6d27457879@mail.gmail.com> Message-ID: <499E24E7.20104@pacific.edu> Wow, haven't seen that in a long time. And it happened on the same deprecation warning. Ken Campbell Barton wrote: > Recently I wanted to deprecate some functions in our the C api, and > found that warnings give weired output when running through through > our C api. > > A simple test is to do this... > > print range(1.5) > > When I run this from python I get good output.. > test.py:1: DeprecationWarning: integer argument expected, got float > print range(1.5) > > But when running from our C api I get > > /home/ideasman42/blender-svn/blender/blender.bin:1: > DeprecationWarning: integer argument expected, got float > ELF?p40?"4()&44?4?44?4?????F??F??F?K ?K ?<@G?K ?K xxHH?H? > P?td?2???C ??C L,L,Q?td/lib/ld-linux.so.2GNU????8?1LQ > ?U?N?.yH {??d > > > I thought this was todo with running a compiled string so I tried > PyRun_String() on the text buffer instead of PyEval_EvalCode() but the > same problem. > Id be interested to know if anyones embedded python gives proper warnings. > On Linux testing with python 2.6 here. > > From ideasman42 at gmail.com Mon Feb 23 02:45:39 2009 From: ideasman42 at gmail.com (Campbell Barton) Date: Sun, 22 Feb 2009 17:45:39 -0800 Subject: [capi-sig] Garbage output from warnings with embedded python In-Reply-To: <7c1ab96d0902191924p1811021cie9c24f6d27457879@mail.gmail.com> References: <7c1ab96d0902191924p1811021cie9c24f6d27457879@mail.gmail.com> Message-ID: <7c1ab96d0902221745ye64e97brebf0dea6c433c01a@mail.gmail.com> Still not sure why this happens. Did a test with a small C/Python file that just runs external scripts, with compiling AND running as a string I don't print gibberish. So for now I added this to our own warning function... // import sys; print '\t%s:%d' % (sys._getframe(0).f_code.co_filename, sys._getframe(0).f_lineno) PyObject *getframe, *frame; PyObject *f_lineno, *f_code, *co_filename; getframe = PySys_GetObject("_getframe"); // borrowed if (getframe) { frame = PyObject_CallObject(getframe, NULL); if (frame) { f_lineno= PyObject_GetAttrString(frame, "f_lineno"); f_code= PyObject_GetAttrString(frame, "f_code"); if (f_lineno && f_code) { co_filename= PyObject_GetAttrString(f_code, "co_filename"); if (co_filename) { printf("\t%s:%d\n", PyString_AsString(co_filename),(int)PyInt_AsLong(f_lineno)); Py_DECREF(f_lineno); Py_DECREF(f_code); Py_DECREF(co_filename); Py_DECREF(frame); return; } } Py_XDECREF(f_lineno); Py_XDECREF(f_code); Py_DECREF(frame); } } PyErr_Clear(); printf("\tERROR - Could not access sys._getframe(0).f_lineno or sys._getframe().f_code.co_filename\n");