public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM] tromey/python-checker: decref fix in python.c
@ 2013-04-19 16:38 tromey
0 siblings, 0 replies; only message in thread
From: tromey @ 2013-04-19 16:38 UTC (permalink / raw)
To: archer-commits
The branch, tromey/python-checker has been updated
discards d91d291cba120e7c76d8ce1511cc9b9585c4b405 (commit)
discards 85b634cb836608272901fcc496bf464567cb0800 (commit)
discards 5ef5c08975d0c5fb4e4aec8f448afeb891483bdd (commit)
discards 95b1376c46af5c86942b6b3cd149264c7b369a7b (commit)
discards d88c1ef43ee89085b583a0487069627cf5dc2a59 (commit)
discards 61220805b994e8bb9a05475671bdafec8bcfb1f1 (commit)
discards 966f379e4f411f7d60c4b5307c492ded26e53906 (commit)
discards b97d3201ce52788cf122546fb7adcdfa9d682607 (commit)
discards 1915b06c21dec6f7878d4ec43dbdb94a27e4e7d3 (commit)
discards c8866f512f05112e4902d8d1ec6b66b03060b750 (commit)
discards 5a056ce2a3e5f623581d98949fcdf848b7701a15 (commit)
discards 8f25c9d1697a6b65c54b91de07a4b787c8f97ebd (commit)
discards fe3ed87265788a9ea52988aa59f587cb2630cbd5 (commit)
discards 22014c728f2e435ecf89daf4e778493ae683e946 (commit)
discards c35abeed07e4da3ad9c1cfcdec8846dde93ef4e5 (commit)
discards f413ed7a1b9fb3d4bcc70103c90ea3620bd80ce8 (commit)
discards c0d7976b41d90bb7b126bdd18b47e4950d6b0b29 (commit)
discards 063f309cf6fb5a893c334250f5f86b6c53aeac09 (commit)
discards 551c7ca879d4cf14daac72b6dd35b6856a3d6da9 (commit)
discards 642dbba398dc16c7bcaaad738b28b8d6272d3cb6 (commit)
discards e2e1365db863dc75931da51edd60c4bbb0b402be (commit)
discards 7edc500296b8a371e9fbe88d450b8862d0bbab43 (commit)
discards 3ff56574e73cbef97e2f132acceb27438985d1fe (commit)
discards 36ab1eef0093c6743b1a8231fcbbacca22c2cdc9 (commit)
discards 522db6fae0ee6edb4b17db5bdcd7894e2d8f2d3d (commit)
discards 70f2277ebeca38e968aa75dcb773f2e5494da7fa (commit)
discards de8cc14de16df8f581d776a3a559ddda4d08fa7c (commit)
via fa023ab4689d4a363e0f5c9967fecbb29717566a (commit)
via fe12a8e7fa42bec61e7a6abf77bfbc0de9aa572a (commit)
via 7f16ed19218609150579ec82f92c66b9d738b1f7 (commit)
via da487190a16554ea31b742ca14084ee900b31dcb (commit)
via f2438b02cc98b1546a3841961a0fccab305e64ef (commit)
via 9c470d286cd4fdaff20def6dda68a06d9cf8a947 (commit)
via c8900023d96f1f829d0fcd795b16cde2c11a5648 (commit)
via d1a094b4ccf0ff51683e20049a93a907907cf7e1 (commit)
via ac6fcd7f576bdbcd02f294bba29a9f0feec88246 (commit)
via ae8d0299e414c8f0c652791cb70e7cd73f9c0835 (commit)
via 2779a3998f7a841f219ea25da696b6b606a90b46 (commit)
via 2ce0ffee4a83b9e965f6f891ae15ad005331bb53 (commit)
via 8d65ef5d84b128321e70aace683d20f359461251 (commit)
via 7fde3b789f826efb195a3194fa59a57ee003daa1 (commit)
via d8980c0d080a750e1b5509acace209176d67f9bd (commit)
via f09ac8e4ddb94788f254bd00164f76ec7e2aee44 (commit)
via 7b2412d18e4188ddfe97add2a78e11832da1ad0c (commit)
via 7fe12f1d9d0440bd8b7195f7ca53b54813fff364 (commit)
via b84683dc77199b1815b7a6819d8b47a0d5861b76 (commit)
via 676494ee0576bdad2685db76959b4ff8352b1c70 (commit)
via 6d966f5aef5fc0bbebbc66c87f7eb456da9f0bab (commit)
via b839f7ae0424d75acd9640a9c7a2306919d10cb9 (commit)
via d7dd74b3174444dfbc31c95864541e3c86a3dfd3 (commit)
via 8e3952ac4b801b7656da99952ef1299729368bef (commit)
via a1a3207425865c73bb54099458b0bf2f34d1bba9 (commit)
via dcd2162f91d80718b648e9e2c589ce9dc1197860 (commit)
via c09308dd0738e16fd91dc84fcf46afda1248f5d1 (commit)
via 030d6d76b05c55c3fba6cf7b20ddcf5be33ff5c0 (commit)
via 53f3d1819cedb4efdfb5b2a370ac1786345d3872 (commit)
from d91d291cba120e7c76d8ce1511cc9b9585c4b405 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email.
- Log -----------------------------------------------------------------
commit fa023ab4689d4a363e0f5c9967fecbb29717566a
Author: Tom Tromey <tromey@redhat.com>
Date: Fri Apr 19 09:04:08 2013 -0600
decref fix in python.c
* python/python.c (finish_python_initialization): Decref
'pythondir' on failure path as well.
commit fe12a8e7fa42bec61e7a6abf77bfbc0de9aa572a
Author: Tom Tromey <tromey@redhat.com>
Date: Thu Apr 18 12:51:02 2013 -0600
fix refcount bug in search_pp_list
The checker noticed a missing decref in search_pp_list.
* python/py-prettyprint.c (search_pp_list): Decref 'attr'.
commit 7f16ed19218609150579ec82f92c66b9d738b1f7
Author: Tom Tromey <tromey@redhat.com>
Date: Thu Apr 18 12:50:46 2013 -0600
rearrange for some clarity in valpy_get_dynamic_type
The checker noticed some funny code in valpy_get_dynamic_type. This
simplifies the code a little and also changes an incref to an xincref;
the current code could crash if type_to_type_object failed.
* python/py-value.c (valpy_get_dynamic_type): Simplify
dynamic_type assignment. Use Py_XINCREF.
commit da487190a16554ea31b742ca14084ee900b31dcb
Author: Tom Tromey <tromey@redhat.com>
Date: Thu Apr 18 12:32:24 2013 -0600
fix refcount bug in typy_fields
The checker found a bug in typy_fields -- we leaked a reference in one
path.
* python/py-type.c (typy_fields): Unconditionally decref 'r'.
commit f2438b02cc98b1546a3841961a0fccab305e64ef
Author: Tom Tromey <tromey@redhat.com>
Date: Thu Apr 18 11:40:47 2013 -0600
some py-frame.c changes to make the checker work better
The checker complained about some code in py-frame.c that was simple
to refactor into a digestible form.
* python/py-frame.c (frapy_older, frapy_newer, gdbpy_newest_frame)
(gdbpy_selected_frame): Move object-construction code
out of TRY_CATCH.
commit 9c470d286cd4fdaff20def6dda68a06d9cf8a947
Author: Tom Tromey <tromey@redhat.com>
Date: Thu Apr 18 11:26:10 2013 -0600
introduce gdb_pymodule_addobject
The checker pointed out that this common idiom in gdb is wrong:
- Py_INCREF (&arch_object_type);
- return PyModule_AddObject (gdb_module, "Architecture",
- (PyObject *) &arch_object_type);
This is buggy because if PyModule_AddObject fails, then the reference
will not be stolen. So, the object will be leaked.
This isn't extremely important, as such failures probably won't
actually happen. Nevertheless it is better to be clean; and also
remove false reports from the checker.
This patch does so by introducing a wrapper function for
PyModule_AddObject that doesn't steal a reference.
* python/py-arch.c (gdbpy_initialize_arch): Use
gdb_pymodule_addobject.
* python/py-block.c (gdbpy_initialize_blocks): Use
gdb_pymodule_addobject.
* python/py-breakpoint.c (gdbpy_initialize_breakpoints): Use
gdb_pymodule_addobject.
* python/py-cmd.c (gdbpy_initialize_breakpoints): Use
gdb_pymodule_addobject.
* python/py-event.c (gdbpy_initialize_event_generic): Use
gdb_pymodule_addobject.
* python/py-evtregistry.c (gdbpy_initialize_eventregistry): Use
gdb_pymodule_addobject.
* python/py-evts.c (add_new_registry): Use
gdb_pymodule_addobject.
(gdbpy_initialize_py_events): Likewise.
* python/py-finishbreakpoint.c
(gdbpy_initialize_finishbreakpoints): Use
gdb_pymodule_addobject.
* python/py-frame.c (gdbpy_initialize_frames): Use
gdb_pymodule_addobject.
* python/py-function.c (gdbpy_initialize_functions): Use
gdb_pymodule_addobject.
* python/py-inferior.c (gdbpy_initialize_inferior): Use
gdb_pymodule_addobject.
* python/py-infthread.c (gdbpy_initialize_thread): Use
gdb_pymodule_addobject.
* python/py-objfile.c (gdbpy_initialize_objfile): Use
gdb_pymodule_addobject.
* python/py-param.c (gdbpy_initialize_parameters): Use
gdb_pymodule_addobject.
* python/py-progspace.c (gdbpy_initialize_pspace): Use
gdb_pymodule_addobject.
* python/py-symbol.c (gdbpy_initialize_symbols): Use
gdb_pymodule_addobject.
* python/py-symtab.c (gdbpy_initialize_symtabs): Use
gdb_pymodule_addobject.
* python/py-type.c (gdbpy_initialize_types): Use
gdb_pymodule_addobject.
* python/py-utils.c (gdb_pymodule_addobject): New function.
* python/py-value.c (gdbpy_initialize_values): Use
gdb_pymodule_addobject.
* python/python-internal.h (gdb_pymodule_addobject): Declare.
* python/python.c (_initialize_python): Use
gdb_pymodule_addobject.
commit c8900023d96f1f829d0fcd795b16cde2c11a5648
Author: Tom Tromey <tromey@redhat.com>
Date: Thu Apr 18 10:52:17 2013 -0600
use explicit decrefs rather than cleanups in some cases
The checker doesn't understand cleanups, and probably never will.
However, in a few places, I think we use cleanups where explicit
decref calls are just as clean. So, this patch changes those spots
and silences the checker.
There are other spots using decref cleanups that can't readily be
changed. For example, the pretty-printing code calls into parts of
gdb that can throw, and so cleanups must be used.
* python/py-cmd.c (cmdpy_completer): Use explicit decref.
* python/py-param.c (get_set_value, get_show_value): Use
explicit decrefs.
* python/python.c (start_type_printers, apply_type_printers):
Use explicit decrefs.
commit d1a094b4ccf0ff51683e20049a93a907907cf7e1
Author: Tom Tromey <tromey@redhat.com>
Date: Thu Apr 18 08:53:14 2013 -0600
remove erroneous incref from gdbpy_initialize_py_events
The checker noticed a bogus incref in gdbpy_initialize_py_events.
* python/py-evts.c (gdbpy_initialize_py_events): Don't
incref the module.
commit ac6fcd7f576bdbcd02f294bba29a9f0feec88246
Author: Tom Tromey <tromey@redhat.com>
Date: Thu Apr 18 07:46:18 2013 -0600
fix refcounting in gdbpy_run_events
The checker noticed a missing decref in gdbpy_run_events.
* python/python.c (gdbpy_run_events): Decref the result
of PyObject_CallObject.
commit ae8d0299e414c8f0c652791cb70e7cd73f9c0835
Author: Tom Tromey <tromey@redhat.com>
Date: Wed Apr 17 14:43:26 2013 -0600
make set_sal follow negative result convention
This changes set_sal to follow the "negative means error" convention.
This lets the checker understand it.
* python/py-symtab.c (set_sal): Use
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION. Return -1 on error.
(symtab_and_line_to_sal_object): Update.
commit 2779a3998f7a841f219ea25da696b6b606a90b46
Author: Tom Tromey <tromey@redhat.com>
Date: Wed Apr 17 14:35:18 2013 -0600
add missing decref in py-param.c
The checker found a missing decref in compute_enum_values.
* python/py-param.c (compute_enum_values): Decref 'item'.
commit 2ce0ffee4a83b9e965f6f891ae15ad005331bb53
Author: Tom Tromey <tromey@redhat.com>
Date: Wed Apr 17 13:31:38 2013 -0600
check gdb_python_initialized everywhere
This patch changes the rest of gdb to use gdb_python_initialized. It
also changes ensure_python_env to throw an exception if Python is not
initialized. In some spots no other checks were needed -- there is no
way to reach some of the calls to ensure_python_env unless some
previous call into Python was made.
value_get_print_value had to be reindented, which is why that part of
the patch looks odd.
* mi/mi-main.c: Include python-internal.h.
(mi_cmd_list_features): Check gdb_python_initialized.
* python/py-inferior.c (python_on_normal_stop, python_on_resume)
(python_inferior_exit, python_new_objfile, add_thread_object)
(delete_thread_object, py_free_inferior): Check
gdb_python_initialized.
* python/py-prettyprint.c (apply_val_pretty_printer): Check
gdb_python_initialized.
* python/py-type.c (save_objfile_types): Check
gdb_python_initialized.
* python/python-internal.h (gdb_python_initialized): Declare.
* python/python.c (ensure_python_env): Throw exception if
Python not initialized.
(before_prompt_hook, source_python_script_for_objfile)
(start_type_printers, apply_type_printers,
free_type_printers): Check gdb_python_initialized.
* varobj.c (varobj_get_display_hint)
(dynamic_varobj_has_child_method, update_dynamic_varobj_children)
(install_new_value_visualizer, varobj_set_visualizer)
(value_get_print_value): Check gdb_python_initialized.
commit 8d65ef5d84b128321e70aace683d20f359461251
Author: Tom Tromey <tromey@redhat.com>
Date: Wed Apr 17 13:12:59 2013 -0600
convert python init functions to do error-checking
The checker pointed out that we did not do Python error checking in
any of our module initialization functions. There is no deep reason
for this -- just that it is common in the Python world to work this
way. However, it seems cleaner to me to be correct, and it makes the
checker quieter besides.
This changes nearly all of the Python initialization functions to
return -1 on error.
This also introduces gdb_python_initialized, which is set to a
non-zero value if initialization went properly. A subsequent patch
will use this to disable Python support if initialization failed.
* python/py-arch.c (gdbpy_initialize_arch): Return 'int'.
Check errors.
* python/py-auto-load.c (gdbpy_initialize_auto_load): Return 'int'.
* python/py-block.c (gdbpy_initialize_blocks): Return 'int'.
Check errors.
* python/py-breakpoint.c (gdbpy_initialize_breakpoints): Return 'int'.
Check errors.
* python/py-cmd.c (gdbpy_initialize_commands): Return 'int'.
Check errors.
* python/py-event.c (gdbpy_initialize_event): Return 'int'.
Check errors.
* python/py-event.h (GDBPY_NEW_EVENT_TYPE): Change generated
init function to return 'int'.
* python/py-evtregistry.c (gdbpy_initialize_eventregistry):
Return 'int'. Check errors.
* python/py-evts.c (gdbpy_initialize_py_events): Return 'int'.
Check errors.
* python/py-finishbreakpoint.c (gdbpy_initialize_finishbreakpoints):
Return 'int'. Check errors.
* python/py-frame.c (gdbpy_initialize_frames): Return 'int'.
Check errors.
* python/py-function.c (gdbpy_initialize_functions): Return 'int'.
Check errors.
* python/py-gdb-readline.c (gdbpy_initialize_gdb_readline):
Check errors.
* python/py-inferior.c (gdbpy_initialize_inferior): Return 'int'.
Check errors.
* python/py-infthread.c (gdbpy_initialize_thread): Return 'int'.
Check errors.
* python/py-lazy-string.c (gdbpy_initialize_lazy_string): Return 'int'.
Check errors.
* python/py-objfile.c (gdbpy_initialize_objfile): Return 'int'.
Check errors.
* python/py-param.c (gdbpy_initialize_parameters): Return 'int'.
Check errors.
* python/py-progspace.c (gdbpy_initialize_pspace): Return 'int'.
Check errors.
* python/py-symbol.c (gdbpy_initialize_symbols): Return 'int'.
Check errors.
* python/py-symtab.c (gdbpy_initialize_symtabs): Return 'int'.
Check errors.
* python/py-type.c (gdbpy_initialize_types): Return 'int'.
Check errors.
* python/py-value.c (gdbpy_initialize_values): Return 'int'.
Check errors.
* python/python-internal.h (gdbpy_initialize_auto_load,
gdbpy_initialize_values, gdbpy_initialize_frames,
gdbpy_initialize_symtabs, gdbpy_initialize_commands,
gdbpy_initialize_symbols, gdbpy_initialize_symtabs,
gdbpy_initialize_blocks, gdbpy_initialize_types,
gdbpy_initialize_functions, gdbpy_initialize_pspace,
gdbpy_initialize_objfile, gdbpy_initialize_breakpoints,
gdbpy_initialize_finishbreakpoints,
gdbpy_initialize_lazy_string, gdbpy_initialize_parameters,
gdbpy_initialize_thread, gdbpy_initialize_inferior,
gdbpy_initialize_eventregistry, gdbpy_initialize_event,
gdbpy_initialize_py_events, gdbpy_initialize_stop_event,
gdbpy_initialize_signal_event,
gdbpy_initialize_breakpoint_event,
gdbpy_initialize_continue_event,
gdbpy_initialize_exited_event, gdbpy_initialize_thread_event,
gdbpy_initialize_new_objfile_event, gdbpy_initialize_arch):
Update. Use CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION.
* python/python.c (gdb_python_initialized): New global.
(gdbpy_initialize_events): Return 'int'. Check errors.
(_initialize_python): Check errors. Set
gdb_python_initialized.
commit 7fde3b789f826efb195a3194fa59a57ee003daa1
Author: Tom Tromey <tromey@redhat.com>
Date: Wed Apr 17 12:20:47 2013 -0600
reference count in bpfinishpy_out_of_scope
The checker noticed a missing decref in bpfinishpy_out_of_scope.
* python/py-finishbreakpoint.c (bpfinishpy_out_of_scope):
Decref the reslut of PyObject_CallMethod.
commit d8980c0d080a750e1b5509acace209176d67f9bd
Author: Tom Tromey <tromey@redhat.com>
Date: Wed Apr 17 12:05:32 2013 -0600
fix bug in gdbpy_initialize_event_generic
The checker noticed that gdbpy_initialize_event_generic could do an
extra decref of 'type' if PyType_Ready failed. This fixes the bug.
* python/py-event.c (gdbpy_initialize_event_generic): Return
early if PyType_Ready fails.
commit f09ac8e4ddb94788f254bd00164f76ec7e2aee44
Author: Tom Tromey <tromey@redhat.com>
Date: Wed Apr 17 10:29:30 2013 -0600
add gdb_assert_not_reached
This patch adds a gdb_assert_not_reached to a switch in
make_fielditem. This avoids a checker complaint.
* python/py-type.c (make_fielditem): Add gdb_assert_not_reached
as 'default' in the switch.
commit 7b2412d18e4188ddfe97add2a78e11832da1ad0c
Author: Tom Tromey <tromey@redhat.com>
Date: Wed Apr 17 10:23:52 2013 -0600
fix get_addr_from_python
get_addr_from_python confused the checker and so I decided to change
it to a form that it found more palatable. In particular now it
returns a negative value on error (using
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION), and it can no longer throw
a gdb exception. This let me hoist calls to it out of some
TRY_CATCHes.
* python/py-inferior.c (gdbpy_inferiors): Update. Hoist
get_addr_from_python calls out of TRY_CATCH.
(infpy_write_memory, infpy_search_memory): Likewise.
* python/py-utils.c (get_addr_from_python): Return negative
value on error. Use TRY_CATCH.
* python/python-internal.h (get_addr_from_python): Use
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION.
commit 7fe12f1d9d0440bd8b7195f7ca53b54813fff364
Author: Tom Tromey <tromey@redhat.com>
Date: Wed Apr 17 09:31:55 2013 -0600
add decref in evpy_emit_event
The checker noticed a missing decref in evpy_emit_event.
* python/py-event.c (evpy_emit_event): Decref the
result of PyObject_CallFunctionObjArgs.
commit b84683dc77199b1815b7a6819d8b47a0d5861b76
Author: Tom Tromey <tromey@redhat.com>
Date: Wed Apr 17 09:12:51 2013 -0600
use iterator protocol and avoid refcount bugs
The checker pointed out some refcounting bugs in cmdpy_completer.
And, while looking at it, I noticed that it was not using the iterator
protocol. I couldn't think of a reason why not; and using an iterator
cleaned up the code, so this patch does that.
* python/py-cmd.c (cmdpy_completer): Use iterator protocol.
Correctly decref.
commit 676494ee0576bdad2685db76959b4ff8352b1c70
Author: Tom Tromey <tromey@redhat.com>
Date: Wed Apr 17 08:56:13 2013 -0600
add decref to cmdpy_init
The checker pointed out some missing decrefs in cmdpy_init.
This patch adds them.
* python/py-cmd.c (cmdpy_init): Decref 'ds_obj'.
commit 6d966f5aef5fc0bbebbc66c87f7eb456da9f0bab
Author: Tom Tromey <tromey@redhat.com>
Date: Wed Apr 17 08:52:35 2013 -0600
introduce and use CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
The checker provides an attribute that indicates that a function sets
the Python exception if it returns a negative value. This patch
introduces a new macro for this attribute and changes gdb to use it
where appropriate.
* python/py-event.h (gdbpy_initialize_event_generic): Use
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION.
* python/py-evts.c (add_new_registry): Use
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION.
* python/python-internal.h
(CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION): New macro.
commit b839f7ae0424d75acd9640a9c7a2306919d10cb9
Author: Tom Tromey <tromey@redhat.com>
Date: Mon Mar 4 08:45:17 2013 -0700
use CPYCHECKER_SETS_EXCEPTION
The checker defines an attribute that can be used to indicate that a
function sets the Python exception.
This patch introduces a new macro for this attribute and changes gdb
to use it. I also changed gdbpy_convert_exception to return 'void'.
This is friendlier to the checker, which didn't recognize our current
convention; but also turns out to clean up the code a little.
* python/py-arch.c (archpy_disassemble): Update.
* python/py-type.c (typy_get_composite, typy_lookup_typename)
(typy_lookup_type): Use GDB_PY_HANDLE_EXCEPTION.
* python/py-utils.c (gdbpy_convert_exception): Return 'void'.
* python/python-internal.h (CPYCHECKER_SETS_EXCEPTION): New
macro.
(GDB_PY_HANDLE_EXCEPTION): Update.
(gdbpy_convert_exception): Update. Use CPYCHECKER_SETS_EXCEPTION.
commit d7dd74b3174444dfbc31c95864541e3c86a3dfd3
Author: Tom Tromey <tromey@redhat.com>
Date: Mon Mar 4 07:45:33 2013 -0700
remove unused declaration
I happened to notice that we declare but do not define
events_object_type. This removes it.
* python/python-internal.h (events_object_type): Remove.
commit 8e3952ac4b801b7656da99952ef1299729368bef
Author: Tom Tromey <tromey@redhat.com>
Date: Wed Jan 4 15:00:57 2012 -0700
fix py-evtregistry.c refcount bug
The checker found a refcounting bug in py-evtregistry.c.
This fixes it.
* py-evtregistry.c (create_event_object): Decref
eventregistry_object if PyList_New fails.
commit a1a3207425865c73bb54099458b0bf2f34d1bba9
Author: Tom Tromey <tromey@redhat.com>
Date: Wed Jan 4 14:59:59 2012 -0700
py-cmd.c error-checking bug fix
The checker found an error-checking bug in py-cmd.c.
This fixes it.
* py-cmd.c (gdbpy_string_to_argv): Check result of
PyList_New.
commit dcd2162f91d80718b648e9e2c589ce9dc1197860
Author: Tom Tromey <tromey@redhat.com>
Date: Thu Apr 18 14:50:46 2013 -0600
add missing decref in before_prompt_hook
The checker noticed a missing decref in before_prompt_hook.
* python/python.c (before_prompt_hook): Add cleanup to
decref 'hook'.
commit c09308dd0738e16fd91dc84fcf46afda1248f5d1
Author: Tom Tromey <tromey@redhat.com>
Date: Wed Jan 4 14:41:44 2012 -0700
PyObject_GetAttrString returns a new ref
This fixes a bug in py-function.c pointed out by the checker.
PyObject_GetAttrString returns a new ref, so we must decref it.
commit 030d6d76b05c55c3fba6cf7b20ddcf5be33ff5c0
Author: Tom Tromey <tromey@redhat.com>
Date: Fri Apr 19 08:19:12 2013 -0600
add borrowed-ref attribute from the python checker
This adds the borrowed-ref attribute from the CPython checker, and
then updates the code to use it in various places. This attribute
tells the checker that a function returns a borrowed reference.
* python/py-threadevent.c (get_event_thread): Use
CPYCHECKER_RETURNS_BORROWED_REF.
* python/python-internal.h (CPYCHECKER_RETURNS_BORROWED_REF):
New define.
(pspace_to_pspace_object, objfile_to_objfile_object)
(find_thread_object): Use it.
commit 53f3d1819cedb4efdfb5b2a370ac1786345d3872
Author: Tom Tromey <tromey@redhat.com>
Date: Fri Apr 19 08:18:52 2013 -0600
introduce CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF and use it
This introduces the CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF attribute and
changes the Python code to use it. This attribute associates a Python
type object with a particular implementation type. The checker uses
this information to improve its analysis in some cases.
* python/py-arch.c (arch_object_type): Use
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.
* python/py-block.c (block_syms_iterator_object_type):
Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.
* python/py-bpevent.c (breakpoint_event_object_type):
Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.
* python/py-cmd.c (cmdpy_object_type): Use
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.
* python/py-continueevent.c (continue_event_object_type):
Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.
* python/py-event.h (GDBPY_NEW_EVENT_TYPE):
Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.
* python/py-events.h (thread_event_object_type):
Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.
* python/py-evtregistry.c (eventregistry_object_type): Use
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.
* python/py-exitedevent.c (exited_event_object_type):
Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.
* python/py-finishbreakpoint.c (finish_breakpoint_object_type):
Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.
* python/py-function.c (fnpy_object_type): Use
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.
* python/py-inferior.c (inferior_object_type, membuf_object_type):
Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.
* python/py-infthread.c (thread_object_type): Use
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.
* python/py-lazy-string.c (lazy_string_object_type):
Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.
* python/py-newobjfileevent.c (new_objfile_event_object_type):
Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.
* python/py-objfile.c (objfile_object_type): Use
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.
* python/py-param.c (parmpy_object_type):
Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.
* python/py-progspace.c (pspace_object_type):
Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.
* python/py-signalevent.c (signal_event_object_type):
Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.
* python/py-symtab.c (symtab_object_type, sal_object_type): Use
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.
* python/py-type.c (type_object_type, field_object_type)
(type_iterator_object_type): Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.
* python/py-internal.h (CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF): New
define.
(value_object_type, block_object_type, symbol_object_type)
(event_object_type, stop_event_object_type, breakpoint_object_type)
(frame_object_type): Use CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.
-----------------------------------------------------------------------
Summary of changes:
gdb/python/python-internal.h | 2 --
gdb/python/python.c | 3 +--
2 files changed, 1 insertions(+), 4 deletions(-)
First 500 lines of diff:
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index a9ea13a..a2a5079 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -20,8 +20,6 @@
#ifndef GDB_PYTHON_INTERNAL_H
#define GDB_PYTHON_INTERNAL_H
-/* If we're using the Python checker, define some attributes. The
- checker defines the guard symbol when it starts. */
#ifdef WITH_CPYCHECKER_RETURNS_BORROWED_REF_ATTRIBUTE
#define CPYCHECKER_RETURNS_BORROWED_REF \
__attribute__ ((cpychecker_returns_borrowed_ref))
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 4f69c32..ad1b3a6 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1761,10 +1761,9 @@ finish_python_initialization (void)
goto fail;
err = PyList_Insert (sys_path, 0, pythondir);
+ Py_DECREF (pythondir);
if (err)
goto fail;
-
- Py_DECREF (pythondir);
}
else
goto fail;
hooks/post-receive
--
Repository for Project Archer.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-04-19 16:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-19 16:38 [SCM] tromey/python-checker: decref fix in python.c tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).