[issue18213] py-bt errors on backtrace

2013-06-14 Thread Tom Tromey

Changes by Tom Tromey :


--
nosy: +tromey

___
Python tracker 
<http://bugs.python.org/issue18213>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15516] exception-handling bug in PyString_Format

2012-07-31 Thread Tom Tromey

New submission from Tom Tromey:

In gdb we supply a class whose nb_int method can throw
an exception.

A user wrote code like this:

return '%x' % value

... where "value" was an instance of this class.
This caused funny exception behavior later on.
You can see the original report here:

http://sourceware.org/bugzilla/show_bug.cgi?id=14320

I tracked down the odd behavior to this code in
stringobject.c:PyString_Format:

iobj = PyNumber_Int(v);
if (iobj==NULL) iobj = PyNumber_Long(v);

Here, PyNumber_Int fails and sets the exception.
I think this ought to be cleared before calling
PyNumber_Long.  In our case, PyNumber_Long succeeds,
and the program keeps executing until something happens
to call PyErr_Occurred.

I think this patch ought to fix the problem:

diff -r e0eb7dea245f Objects/stringobject.c
--- a/Objects/stringobject.cMon Jul 30 04:07:49 2012 -0700
+++ b/Objects/stringobject.cTue Jul 31 13:58:07 2012 -0600
@@ -4489,7 +4489,10 @@
 }
 else {
 iobj = PyNumber_Int(v);
-if (iobj==NULL) iobj = PyNumber_Long(v);
+if (iobj==NULL) {
+   PyErr_Clear();
+   iobj = PyNumber_Long(v);
+   }
 }
 if (iobj!=NULL) {
 if (PyInt_Check(iobj)) {

I haven't written a test case yet; David Malcolm suggested I file
a bug here first.

--
components: None
messages: 167043
nosy: tromey
priority: normal
severity: normal
status: open
title: exception-handling bug in PyString_Format
type: behavior
versions: Python 2.7

___
Python tracker 
<http://bugs.python.org/issue15516>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15516] exception-handling bug in PyString_Format

2012-07-31 Thread Tom Tromey

Tom Tromey added the comment:

Here is a patch that includes a test case.
The test fails before the stringobject.c patch is applied,
and passes after.

--
Added file: http://bugs.python.org/file26629/P

___
Python tracker 
<http://bugs.python.org/issue15516>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15529] PyIter_Check evaluates to 0 for Python list object

2012-08-01 Thread Tom Tromey

New submission from Tom Tromey:

I was debugging this bug reported against gdb:

http://sourceware.org/bugzilla/show_bug.cgi?id=14386

It turns out that what went wrong in this code was that
PyIter_Check evaluates to 0 when its argument is a
Python list.

This happens because the PyIter_Check macro looks at the
tp_iternext field; but this field is 0 in PyList_Type.

I am not sure of the correct fix; but PyIter_Check is not
faithfully reflecting what PyObject_GetIter does.
Maybe it isn't intended to; but anyway it seems that
checking tp_iter would maybe be a better approximation.

Even if PyIter_Check remains as-is, I think it would be nice
if the documentation were more specific about what it
actually does.

FWIW I'm modifying gdb not to use this function.

--
components: None
messages: 167143
nosy: tromey
priority: normal
severity: normal
status: open
title: PyIter_Check evaluates to 0 for Python list object
versions: Python 2.7

___
Python tracker 
<http://bugs.python.org/issue15529>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15516] exception-handling bug in PyString_Format

2012-12-06 Thread Tom Tromey

Tom Tromey added the comment:

It sure would.
Here's a new patch.

--
Added file: http://bugs.python.org/file28223/P

___
Python tracker 
<http://bugs.python.org/issue15516>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15516] exception-handling bug in PyString_Format

2013-01-02 Thread Tom Tromey

Tom Tromey added the comment:

It does fail without the patch:

test_format
XXX undetected error
test test_format failed -- Traceback (most recent call last):
  File "/home/tromey/Space/Python/cpython/Lib/test/test_format.py", line 251, 
in test_format
def test_exc(formatstr, args, exception, excmsg):
  File "/home/tromey/Space/Python/cpython/Lib/test/test_format.py", line 240, 
in __int__
raise TestFailed
TestFailed

--

___
Python tracker 
<http://bugs.python.org/issue15516>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10112] Use -Wl, --dynamic-list=x.list, not -Xlinker -export-dynamic

2013-10-29 Thread Tom Tromey

Changes by Tom Tromey :


--
nosy: +tromey

___
Python tracker 
<http://bugs.python.org/issue10112>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11410] Use GCC visibility attrs in PyAPI_*

2013-12-02 Thread Tom Tromey

Changes by Tom Tromey :


--
nosy: +tromey

___
Python tracker 
<http://bugs.python.org/issue11410>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com