* [PATCH v2] Fix xmethod Python so that it works with Python 3
@ 2014-08-14 13:53 Siva Chandra
2014-08-14 22:35 ` Doug Evans
0 siblings, 1 reply; 7+ messages in thread
From: Siva Chandra @ 2014-08-14 13:53 UTC (permalink / raw)
To: gdb-patches; +Cc: Doug Evans
[-- Attachment #1: Type: text/plain, Size: 805 bytes --]
The attached patch fixes the "no space before parenthesis in Python"
comment by Joel. The comment was for the changes in the test suite.
Going by examples, I thought the test case code (but not the .exp
files) did not require adherence to coding style.
I also agree with Joel that this patch should also pushed to the 7.8 branch.
ChangeLog:
2014-08-14 Siva Chandra Reddy <sivachandra@gmail.com>
gdb/
* python/lib/gdb/command/xmethods.py (set_xm_status1): Use the
'items' methods instead of 'iteritems' method on dictionaries.
gdb/testsuite/
* gdb.python/py-xmethods.py (A_getarrayind)
(E_method_char_worker.__call__, E_method_int_worker.__call__):
Use 'print' with function call syntax.
(E_method_matcher.match): Fix tab vs space indentation mixup.
[-- Attachment #2: fix_xmethods_for_python3_v2.txt --]
[-- Type: text/plain, Size: 3144 bytes --]
diff --git a/gdb/python/lib/gdb/command/xmethods.py b/gdb/python/lib/gdb/command/xmethods.py
index 55cc81f..206313e 100644
--- a/gdb/python/lib/gdb/command/xmethods.py
+++ b/gdb/python/lib/gdb/command/xmethods.py
@@ -140,7 +140,7 @@ def print_xm_info(xm_dict, name_re):
def set_xm_status1(xm_dict, name_re, status):
"""Set the status (enabled/disabled) of a dictionary of xmethods."""
- for locus_str, matchers in xm_dict.iteritems():
+ for locus_str, matchers in xm_dict.items():
for matcher in matchers:
if not name_re:
# If the name regex is missing, then set the status of the
diff --git a/gdb/testsuite/gdb.python/py-xmethods.py b/gdb/testsuite/gdb.python/py-xmethods.py
index 6fecf2b..47fb00b 100644
--- a/gdb/testsuite/gdb.python/py-xmethods.py
+++ b/gdb/testsuite/gdb.python/py-xmethods.py
@@ -25,22 +25,22 @@ from gdb.xmethod import SimpleXMethodMatcher
def A_plus_A(obj, opr):
- print ('From Python <A_plus_A>:')
+ print('From Python <A_plus_A>:')
return obj['a'] + opr['a']
def plus_plus_A(obj):
- print ('From Python <plus_plus_A>:')
+ print('From Python <plus_plus_A>:')
return obj['a'] + 1
def A_geta(obj):
- print ('From Python <A_geta>:')
+ print('From Python <A_geta>:')
return obj['a']
def A_getarrayind(obj, index):
- print 'From Python <A_getarrayind>:'
+ print('From Python <A_getarrayind>:')
return obj['array'][index]
@@ -61,7 +61,7 @@ class E_method_char_worker(XMethodWorker):
return gdb.lookup_type('char')
def __call__(self, obj, arg):
- print 'From Python <E_method_char>'
+ print('From Python <E_method_char>')
return None
@@ -73,7 +73,7 @@ class E_method_int_worker(XMethodWorker):
return gdb.lookup_type('int')
def __call__(self, obj, arg):
- print 'From Python <E_method_int>'
+ print('From Python <E_method_int>')
return None
@@ -86,7 +86,7 @@ class E_method_matcher(XMethodMatcher):
class_tag = class_type.unqualified().tag
if not re.match('^dop::E$', class_tag):
return None
- if not re.match('^method$', method_name):
+ if not re.match('^method$', method_name):
return None
workers = []
if self.methods[0].enabled:
@@ -109,7 +109,7 @@ class G_size_diff_worker(XMethodWorker):
pass
def __call__(self, obj):
- print ('From Python G<>::size_diff()')
+ print('From Python G<>::size_diff()')
return (self._method_template_type.sizeof -
self._class_template_type.sizeof)
@@ -123,7 +123,7 @@ class G_size_mul_worker(XMethodWorker):
pass
def __call__(self, obj):
- print ('From Python G<>::size_mul()')
+ print('From Python G<>::size_mul()')
return self._class_template_type.sizeof * self._method_template_val
@@ -136,7 +136,7 @@ class G_mul_worker(XMethodWorker):
return self._method_template_type
def __call__(self, obj, arg):
- print ('From Python G<>::mul()')
+ print('From Python G<>::mul()')
return obj['t'] * arg
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v2] Fix xmethod Python so that it works with Python 3
2014-08-14 13:53 [PATCH v2] Fix xmethod Python so that it works with Python 3 Siva Chandra
@ 2014-08-14 22:35 ` Doug Evans
2014-08-16 1:16 ` Siva Chandra
0 siblings, 1 reply; 7+ messages in thread
From: Doug Evans @ 2014-08-14 22:35 UTC (permalink / raw)
To: Siva Chandra; +Cc: gdb-patches
Siva Chandra writes:
> The attached patch fixes the "no space before parenthesis in Python"
> comment by Joel. The comment was for the changes in the test suite.
> Going by examples, I thought the test case code (but not the .exp
> files) did not require adherence to coding style.
>
> I also agree with Joel that this patch should also pushed to the 7.8 branch.
>
> ChangeLog:
> 2014-08-14 Siva Chandra Reddy <sivachandra@gmail.com>
>
> gdb/
>
> * python/lib/gdb/command/xmethods.py (set_xm_status1): Use the
> 'items' methods instead of 'iteritems' method on dictionaries.
>
> gdb/testsuite/
>
> * gdb.python/py-xmethods.py (A_getarrayind)
> (E_method_char_worker.__call__, E_method_int_worker.__call__):
> Use 'print' with function call syntax.
> (E_method_matcher.match): Fix tab vs space indentation mixup.
LGTM
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] Fix xmethod Python so that it works with Python 3
2014-08-14 22:35 ` Doug Evans
@ 2014-08-16 1:16 ` Siva Chandra
2014-08-30 13:48 ` Siva Chandra
0 siblings, 1 reply; 7+ messages in thread
From: Siva Chandra @ 2014-08-16 1:16 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
On Thu, Aug 14, 2014 at 3:34 PM, Doug Evans <dje@google.com> wrote:
> Siva Chandra writes:
> > The attached patch fixes the "no space before parenthesis in Python"
> > comment by Joel. The comment was for the changes in the test suite.
> > Going by examples, I thought the test case code (but not the .exp
> > files) did not require adherence to coding style.
> >
> > I also agree with Joel that this patch should also pushed to the 7.8 branch.
> >
> > ChangeLog:
> > 2014-08-14 Siva Chandra Reddy <sivachandra@gmail.com>
> >
> > gdb/
> >
> > * python/lib/gdb/command/xmethods.py (set_xm_status1): Use the
> > 'items' methods instead of 'iteritems' method on dictionaries.
> >
> > gdb/testsuite/
> >
> > * gdb.python/py-xmethods.py (A_getarrayind)
> > (E_method_char_worker.__call__, E_method_int_worker.__call__):
> > Use 'print' with function call syntax.
> > (E_method_matcher.match): Fix tab vs space indentation mixup.
>
> LGTM
Pushed 940df408121be31beed22ef7a5ad133cb1592726.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] Fix xmethod Python so that it works with Python 3
2014-08-16 1:16 ` Siva Chandra
@ 2014-08-30 13:48 ` Siva Chandra
2014-09-01 6:30 ` Joel Brobecker
0 siblings, 1 reply; 7+ messages in thread
From: Siva Chandra @ 2014-08-30 13:48 UTC (permalink / raw)
To: Doug Evans, Joel Brobecker; +Cc: gdb-patches
On Fri, Aug 15, 2014 at 6:16 PM, Siva Chandra <sivachandra@google.com> wrote:
> On Thu, Aug 14, 2014 at 3:34 PM, Doug Evans <dje@google.com> wrote:
>> Siva Chandra writes:
>> > The attached patch fixes the "no space before parenthesis in Python"
>> > comment by Joel. The comment was for the changes in the test suite.
>> > Going by examples, I thought the test case code (but not the .exp
>> > files) did not require adherence to coding style.
>> >
>> > I also agree with Joel that this patch should also pushed to the 7.8 branch.
>> >
>> > ChangeLog:
>> > 2014-08-14 Siva Chandra Reddy <sivachandra@gmail.com>
>> >
>> > gdb/
>> >
>> > * python/lib/gdb/command/xmethods.py (set_xm_status1): Use the
>> > 'items' methods instead of 'iteritems' method on dictionaries.
>> >
>> > gdb/testsuite/
>> >
>> > * gdb.python/py-xmethods.py (A_getarrayind)
>> > (E_method_char_worker.__call__, E_method_int_worker.__call__):
>> > Use 'print' with function call syntax.
>> > (E_method_matcher.match): Fix tab vs space indentation mixup.
>>
>> LGTM
>
> Pushed 940df408121be31beed22ef7a5ad133cb1592726.
Missed asking: OK for 7.8 branch?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] Fix xmethod Python so that it works with Python 3
2014-08-30 13:48 ` Siva Chandra
@ 2014-09-01 6:30 ` Joel Brobecker
2014-09-02 13:23 ` Siva Chandra
0 siblings, 1 reply; 7+ messages in thread
From: Joel Brobecker @ 2014-09-01 6:30 UTC (permalink / raw)
To: Siva Chandra; +Cc: Doug Evans, gdb-patches
> >> > ChangeLog:
> >> > 2014-08-14 Siva Chandra Reddy <sivachandra@gmail.com>
> >> >
> >> > gdb/
> >> >
> >> > * python/lib/gdb/command/xmethods.py (set_xm_status1): Use the
> >> > 'items' methods instead of 'iteritems' method on dictionaries.
> >> >
> >> > gdb/testsuite/
> >> >
> >> > * gdb.python/py-xmethods.py (A_getarrayind)
> >> > (E_method_char_worker.__call__, E_method_int_worker.__call__):
> >> > Use 'print' with function call syntax.
> >> > (E_method_matcher.match): Fix tab vs space indentation mixup.
> >>
> >> LGTM
> >
> > Pushed 940df408121be31beed22ef7a5ad133cb1592726.
>
> Missed asking: OK for 7.8 branch?
Yes. Pleasae make sure to update the branch's wiki as well
(section "Fixes in 7.8.1" - you might need to create a PR for that).
Thanks,
--
Joel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] Fix xmethod Python so that it works with Python 3
2014-09-01 6:30 ` Joel Brobecker
@ 2014-09-02 13:23 ` Siva Chandra
2014-09-02 14:37 ` Joel Brobecker
0 siblings, 1 reply; 7+ messages in thread
From: Siva Chandra @ 2014-09-02 13:23 UTC (permalink / raw)
To: Joel Brobecker; +Cc: Doug Evans, gdb-patches
On Sun, Aug 31, 2014 at 11:30 PM, Joel Brobecker <brobecker@adacore.com> wrote:
>> > Pushed 940df408121be31beed22ef7a5ad133cb1592726.
>>
>> Missed asking: OK for 7.8 branch?
>
> Yes. Pleasae make sure to update the branch's wiki as well
> (section "Fixes in 7.8.1" - you might need to create a PR for that).
Pushed to the branch. For editing the wiki, does my account need some
special permissions? My username is "SivaChandraReddy".
Thanks,
Siva Chandra
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] Fix xmethod Python so that it works with Python 3
2014-09-02 13:23 ` Siva Chandra
@ 2014-09-02 14:37 ` Joel Brobecker
0 siblings, 0 replies; 7+ messages in thread
From: Joel Brobecker @ 2014-09-02 14:37 UTC (permalink / raw)
To: Siva Chandra; +Cc: Doug Evans, gdb-patches
> > Yes. Pleasae make sure to update the branch's wiki as well
> > (section "Fixes in 7.8.1" - you might need to create a PR for that).
>
> Pushed to the branch. For editing the wiki, does my account need some
> special permissions? My username is "SivaChandraReddy".
Yes, you need to be part of the EditorGroup. I've just added you,
so you should be able to edit the wiki now.
--
Joel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-09-02 14:37 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-14 13:53 [PATCH v2] Fix xmethod Python so that it works with Python 3 Siva Chandra
2014-08-14 22:35 ` Doug Evans
2014-08-16 1:16 ` Siva Chandra
2014-08-30 13:48 ` Siva Chandra
2014-09-01 6:30 ` Joel Brobecker
2014-09-02 13:23 ` Siva Chandra
2014-09-02 14:37 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox