By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,345 Members | 1,746 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,345 IT Pros & Developers. It's quick & easy.

function causing core dump

P: n/a
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
Jul 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a

"Xaver Hinterhuber" <xa***************@web.de> wrote in message
news:c7**********@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.



Jul 18 '05 #2

P: n/a
"Xaver Hinterhuber" <xa***************@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.
Jul 18 '05 #3

P: n/a
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
Jul 18 '05 #4

P: n/a

"Michael Hudson" <mw*@python.net> wrote in message
news:m3************@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


Jul 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.