Bug 10806 - Use ensure_python_env over PyGilState_Ensure
Summary: Use ensure_python_env over PyGilState_Ensure
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: python (show other bugs)
Version: archer
: P2 normal
Target Milestone: 7.1
Assignee: Phil Muldoon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-19 10:25 UTC by Phil Muldoon
Modified: 2009-10-23 13:52 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Phil Muldoon 2009-10-19 10:25:34 UTC
Daniel Jacobowitz wrote about some Python/GDB experiences and bugs in the email:

http://sourceware.org/ml/archer/2009-q4/msg00008.html

This bug (and others in their own bugs) is extracted from that email to track
the issue:

* The archer branch calls PyGILState_Ensure in several places where it
should call ensure_python_env.  So python_language was often unset if
I tried 'gdb -ex "source -p file.py"'.  To work around it, I had the
end of file.py register a new gdb.Command, and called the command.
Comment 1 Daniel Jacobowitz 2009-10-19 13:18:41 UTC
This causes a segfault when it triggers.
Comment 2 Phil Muldoon 2009-10-23 13:52:48 UTC
I've checked in a patch to archer-tromey-python. Checked FSF upstream and there
do not appear to be any other areas where PyGILState_Ensure is used. 

commit d4a1bd50bb1d7c3cab75f690597c64191b2b6f78
Author: Phil Muldoon <pmuldoon@redhat.com>
Date:   Thu Oct 22 08:39:28 2009 +0100

    Use ensure_python_dev over PyGILState_Ensure/Release.
    
        2009-10-21  Phil Muldoon <pmuldoon@redhat.com>
    
            PR python/10806
    
            * python/python.c (run_python_script): Use ensure_python_env over
            PyGILState_Ensure.
            (gdbpy_run_events): Likewise.
            (run_python_script): Likewise.
            (source_python_script): Likewise.
            * python/py-breakpoint.c (gdbpy_breakpoint_created): Likewise.
            (gdbpy_breakpoint_deleted): Likewise.
            * python/py-inferior.c (delete_inferior_object): Likewise.
            (add_thread_objet): Likewise.
            (delete_thread_object): Likewise.