[Python-bugs-list] [ python-Bugs-416943 ] 2.1 segfaults on pydoc HTTP

noreply@sourceforge.net noreply@sourceforge.net
Thu, 26 Apr 2001 11:01:01 -0700


Bugs item #416943, was updated on 2001-04-17 20:58
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=416943&group_id=5470

Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
>Priority: 7
Submitted By: Andy Dustman (adustman)
>Assigned to: Ka-Ping Yee (ping)
Summary: 2.1 segfaults on pydoc HTTP 

Initial Comment:
Platform info: 2.1 final, Red Hat 7.1 beta for i386.

Run pydoc -p xxx. Pull up info on a C extension module.
Now
recompile that module so that it changes in a
significant way.
Try to pull it up again and segfault occurs.

#0  0x0808db62 in PyString_FromString (str=0x0) at
Objects/stringobject.c:89
84	}
85	
86	PyObject *
87	PyString_FromString(const char *str)
88	{
89		register size_t size = strlen(str);
90		register PyStringObject *op;
91		if (size > INT_MAX) {
92			PyErr_SetString(PyExc_OverflowError,
93				"string is too long for a Python string");
(gdb) frame 1
#1  0x0808d003 in PyObject_GetAttrString (v=0x8164ec0, 
    name=0x80c888c "__name__") at Objects/object.c:1002
1002			return (*v->ob_type->tp_getattr)(v, name);
(gdb) list
997				     v->ob_type->tp_name,
998				     name);
999			return NULL;
1000		}
1001		else {
1002			return (*v->ob_type->tp_getattr)(v, name);
1003		}
1004	}
1005	
1006	int
(gdb) print (*v->ob_type->tp_getattr)
$1 = {PyObject *()} 0x808b3c8 <meth_getattr>
$6 = {ob_refcnt = 3, ob_type = 0x80bb920, ob_size = 0, 
  tp_name = 0x80aa94e "builtin_function_or_method",
tp_basicsize = 16, 
  tp_itemsize = 0, tp_dealloc = 0x808b390
<meth_dealloc>, tp_print = 0, 
  tp_getattr = 0x808b3c8 <meth_getattr>, tp_setattr =
0, 
  tp_compare = 0x808b550 <meth_compare>, tp_repr =
0x808b4ec <meth_repr>, 
  tp_as_number = 0x0, tp_as_sequence = 0x0,
tp_as_mapping = 0x0, 
  tp_hash = 0x808b5a4 <meth_hash>, tp_call = 0, tp_str
= 0, tp_getattro = 0, 
  tp_setattro = 0, tp_as_buffer = 0x0, tp_flags = 0,
tp_doc = 0x0, 
  tp_traverse = 0, tp_clear = 0, tp_richcompare = 0,
tp_weaklistoffset = 0}
(gdb) print ((PyCFunctionObject *)v)->m_ml
$7 = (PyMethodDef *) 0x401c7ecc
(gdb) print
$8 = 0x0
(gdb) list meth_getattr
67		free_list = m;
68	}
69	
70	static PyObject *
71	meth_getattr(PyCFunctionObject *m, char *name)
72	{
73		if (strcmp(name, "__name__") == 0) {
74			return PyString_FromString(m->m_ml->ml_name);
75		}
76		if (strcmp(name, "__doc__") == 0) {

((PyCFunctionObject *)v)->m_ml->ml_name ==
m->m_ml->ml_name == NULL. From what I can tell, all
members of v->m_ml are NULL. Note that name is getting
smashed somewhere, probably after the call at
Objects/object.c:1002.

Feel free to contact me for further information if
necessary. Complete backtrace attached.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=416943&group_id=5470