Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   function causing core dump (http://www.velocityreviews.com/forums/t330752-function-causing-core-dump.html)

Xaver Hinterhuber 05-10-2004 03:15 PM

function causing core dump
 
Hello pythonistas,

I build a function with the following code segment:

codeObject = new.code(
0, # argcount
0, # nlocals
0, # stacksize
0, # flags
codeString, # code
(), # consts
(), # names
(), # varnames
'content', # filename
'content', # name
3, # first line number
codeString # lnotab
)
f = new.function(codeObject, dict, 'f')
f()

Everything runs fine, until the function is called with f().
When python tries to execute f(), the core dump happens.
I don't have any clue why python core dumps.
The codeString is nothing complex, its a one-liner.
Could you plz give me some tips what I have to do?

With kind regards
Xaver Hinterhuber



Terry Reedy 05-10-2004 04:20 PM

Re: function causing core dump
 

"Xaver Hinterhuber" <xaver_hinterhuber@web.de> wrote in message
news:c7o6al$i1j$1@online.de...
> codeObject = new.code(
> 0, # argcount
> 0, # nlocals
> 0, # stacksize
> 0, # flags
> codeString, # code
> (), # consts
> (), # names
> (), # varnames
> 'content', # filename
> 'content', # name
> 3, # first line number
> codeString # lnotab
> )
> f = new.function(codeObject, dict, 'f')
> f()
>
> Everything runs fine, until the function is called with f().
> When python tries to execute f(), the core dump happens.
> I don't have any clue why python core dumps.
> The codeString is nothing complex, its a one-liner.






Michael Hudson 05-10-2004 05:43 PM

Re: function causing core dump
 
"Xaver Hinterhuber" <xaver_hinterhuber@web.de> writes:

> Hello pythonistas,
>
> I build a function with the following code segment:
>
> codeObject = new.code(
> 0, # argcount
> 0, # nlocals
> 0, # stacksize
> 0, # flags
> codeString, # code
> (), # consts
> (), # names
> (), # varnames
> 'content', # filename
> 'content', # name
> 3, # first line number
> codeString # lnotab
> )
> f = new.function(codeObject, dict, 'f')
> f()
>
> Everything runs fine, until the function is called with f().
> When python tries to execute f(), the core dump happens.
> I don't have any clue why python core dumps.
> The codeString is nothing complex, its a one-liner.
> Could you plz give me some tips what I have to do?


Doesn't the documentation for the new module have warnings plastered
all over it? Why are you using it?

Cheers,
mwh

--
About the use of language: it is impossible to sharpen a
pencil with a blunt axe. It is equally vain to try to do
it with ten blunt axes instead.
-- E.W.Dijkstra, 18th June 1975. Perl did not exist at the time.

Peter Otten 05-10-2004 05:49 PM

Re: function causing core dump
 
Xaver Hinterhuber wrote:

> Hello pythonistas,
>
> I build a function with the following code segment:
>
> codeObject = new.code(
> 0, # argcount
> 0, # nlocals
> 0, # stacksize
> 0, # flags
> codeString, # code
> (), # consts
> (), # names
> (), # varnames
> 'content', # filename
> 'content', # name
> 3, # first line number
> codeString # lnotab
> )
> f = new.function(codeObject, dict, 'f')
> f()
>
> Everything runs fine, until the function is called with f().
> When python tries to execute f(), the core dump happens.
> I don't have any clue why python core dumps.
> The codeString is nothing complex, its a one-liner.
> Could you plz give me some tips what I have to do?
>
> With kind regards
> Xaver Hinterhuber


The easiest approach is probably to start with an attribute set known to be
good:

>>> def f(): pass

....
>>> code = f.func_code
>>> names = dir(code)
>>> names.sort()
>>> for name in names:

.... if not name.startswith("_"):
.... print "%s=%r" % (name, getattr(code, name))
....
co_argcount=0
co_cellvars=()
co_code='d\x00\x00S'
co_consts=(None,)
co_filename='<stdin>'
co_firstlineno=1
co_flags=67
co_freevars=()
co_lnotab=''
co_name='f'
co_names=()
co_nlocals=0
co_stacksize=1
co_varnames=()
>>>


and change the values until you get a core dump - again.

Peter

Terry Reedy 05-10-2004 08:06 PM

Re: function causing core dump
 

"Michael Hudson" <mwh@python.net> wrote in message
news:m3hduokwja.fsf@pc150.maths.bris.ac.uk...
> Doesn't the documentation for the new module have warnings plastered
> all over it?


There is not a specific warning about the possibility of core dumps. Since
this is normally considered an interpreter bug, a specific disclaimer might
be appropriate. And maybe a few code tweaks could be added. At Richard
Hettinger's suggestion, I opened and assigned to him a SourceForge bug
report.
http://sourceforge.net/tracker/index...70&atid=105470

Terry J. Reedy






All times are GMT. The time now is 09:45 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.