function causing core dump

Discussion in 'Python' started by Xaver Hinterhuber, May 10, 2004.

  1. 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
    Xaver Hinterhuber, May 10, 2004
    #1
    1. Advertising

  2. Xaver Hinterhuber

    Terry Reedy Guest

    "Xaver Hinterhuber" <> wrote in message
    news:c7o6al$i1j$...
    > 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.
    Terry Reedy, May 10, 2004
    #2
    1. Advertising

  3. "Xaver Hinterhuber" <> 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.
    Michael Hudson, May 10, 2004
    #3
  4. Xaver Hinterhuber

    Peter Otten Guest

    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
    Peter Otten, May 10, 2004
    #4
  5. Xaver Hinterhuber

    Terry Reedy Guest

    "Michael Hudson" <> wrote in message
    news:...
    > 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
    Terry Reedy, May 10, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike
    Replies:
    0
    Views:
    696
  2. BlueDoze
    Replies:
    2
    Views:
    1,099
    Gordon Beaton
    May 4, 2004
  3. halfdog
    Replies:
    12
    Views:
    12,418
  4. Robert Brewer

    RE: function causing core dump

    Robert Brewer, May 10, 2004, in forum: Python
    Replies:
    5
    Views:
    329
    Peter Otten
    May 17, 2004
  5. Mark Brackett

    Sig handler causing core dump

    Mark Brackett, Nov 3, 2004, in forum: C Programming
    Replies:
    3
    Views:
    525
    Mark Brackett
    Nov 4, 2004
Loading...

Share This Page