[issue16676] Segfault under Python 3.3 after PyType_GenericNew

2013-03-27 Thread Mark Shannon

Mark Shannon added the comment:

This issue should be considered closed.

PyType_GenericNew is a convenience function for typeobjects to put in their 
tp_new slots. Calling it directly only works for some types. 
It worked in 3.2 for dict, but that was happenstance.

You could use 
((PyTypeObject *)type_object)-tp_new((PyTypeObject *)type_object, NULL, NULL);
to call the new method directly, but it would be better to call the 
type_object:
PyObject_CallObject(type_object, NULL);

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16676
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16676] Segfault under Python 3.3 after PyType_GenericNew

2013-03-27 Thread Benjamin Peterson

Changes by Benjamin Peterson benja...@python.org:


--
resolution:  - invalid
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16676
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16676] Segfault under Python 3.3 after PyType_GenericNew

2012-12-14 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16676
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16676] Segfault under Python 3.3 after PyType_GenericNew

2012-12-14 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
nosy: +jcea

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16676
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16676] Segfault under Python 3.3 after PyType_GenericNew

2012-12-14 Thread Mark Shannon

Changes by Mark Shannon m...@hotpy.org:


--
nosy: +Mark.Shannon

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16676
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16676] Segfault under Python 3.3 after PyType_GenericNew

2012-12-13 Thread Tres Seaver

New submission from Tres Seaver:

A test of the 'persistent' package C extension segfaults under 3.3,
but completes successfully under 3.2.  The C function being tested
is a wrapper around PyType_GenericNew:



static PyObject *
simple_new(PyObject *self, PyObject *type_object)
{
if (!PyType_Check(type_object))
{
PyErr_SetString(PyExc_TypeError,
simple_new argument must be a type object.);
return NULL;
}
return PyType_GenericNew((PyTypeObject *)type_object, NULL, NULL);
}


The unit test which segfaults just iterates over basic types:


def test_w_type(self):
for typ in (type, list, dict, tuple, object):
self.assertTrue(isinstance(self._callFUT(typ), typ))

Some digging shows that the segfault comes while deallocating the
newly-made 'dict' object.



#0  dict_dealloc (mp=0x73f9d248) at Objects/dictobject.c:1392
#1  0x004261cb in tupledealloc (op=0x73d90ab8)
at Objects/tupleobject.c:238
#2  0x0048065d in call_function (oparg=optimized out, 
pp_stack=0x7fffa6e0) at Python/ceval.c:4064
#3  PyEval_EvalFrameEx (f=optimized out, throwflag=optimized out)
at Python/ceval.c:2679
#4  0x00480b23 in fast_function (nk=optimized out, na=1, 
n=optimized out, pp_stack=0x7fffa850, func=0x742284d0)
at Python/ceval.c:4150
#5  call_function (oparg=optimized out, pp_stack=0x7fffa850)
at Python/ceval.c:4083

--
components: Extension Modules, Interpreter Core
messages: 177441
nosy: tseaver
priority: normal
severity: normal
status: open
title: Segfault under Python 3.3 after PyType_GenericNew
versions: Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16676
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com