function causing core dump

X

Xaver Hinterhuber

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
 
T

Terry Reedy

Xaver Hinterhuber said:
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.
 
M

Michael Hudson

Xaver Hinterhuber said:
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
 
P

Peter Otten

Xaver said:
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:
.... 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
 
T

Terry Reedy

Michael Hudson said:
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.php?func=detail&aid=951482&group_id=5470&atid=105470

Terry J. Reedy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top