[issue15727] PyType_FromSpecWithBases tp_new bugfix

2021-10-18 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> The danger of PyType_FromSpec()

___
Python tracker 

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



[issue15727] PyType_FromSpecWithBases tp_new bugfix

2018-09-11 Thread Petr Viktorin


Petr Viktorin  added the comment:

Converting static types to heap ones is just one of the reasons to use 
PyType_FromSpec*. Another ones are writing such classes from scratch, and 
converting pure-Python classes to C. I don't think PyObject_FailingNew is a 
good default for either of those.

I think Sehriy's solution in bpo-26979 is better: document this, and allow 
setting a slot to NULL explicitly.

--

___
Python tracker 

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



[issue15727] PyType_FromSpecWithBases tp_new bugfix

2018-04-09 Thread Petr Viktorin

Change by Petr Viktorin :


--
nosy: +Dormouse759

___
Python tracker 

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



[issue15727] PyType_FromSpecWithBases tp_new bugfix

2018-04-08 Thread Nick Coghlan

Change by Nick Coghlan :


--
nosy: +encukou, ncoghlan

___
Python tracker 

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



[issue15727] PyType_FromSpecWithBases tp_new bugfix

2016-10-02 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
type: behavior -> crash
versions: +Python 3.5, Python 3.6, Python 3.7 -Python 3.2, Python 3.3, Python 
3.4

___
Python tracker 

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



[issue15727] PyType_FromSpecWithBases tp_new bugfix

2016-10-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Affected modules were tkinter and curses (see issue23815). This was fixed by 
explicit nullifying tp_new after calling PyType_FromSpec(). Issue26979 was open 
for documenting this danger effect.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue15727] PyType_FromSpecWithBases tp_new bugfix

2012-12-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Robin, do you remember which extension types were affected by this issue?

--
nosy: +pitrou
versions: +Python 3.2, Python 3.3

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



[issue15727] PyType_FromSpecWithBases tp_new bugfix

2012-11-30 Thread Robin Schreiber

Robin Schreiber added the comment:

Here is revised version of the patch. 

Martin von Löwis and I had discovered a way to reproduce problems with 
refactored modules, that
occur without this patch. This is was several months ago, however I will try to 
give you a code sample! :-)

--
keywords: +patch
Added file: 
http://bugs.python.org/file28167/PyType_FromSpecWithBases_tp_new_fix_v1.patch

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



[issue15727] PyType_FromSpecWithBases tp_new bugfix

2012-11-08 Thread Robin Schreiber

Changes by Robin Schreiber robin.schrei...@me.com:


--
keywords: +pep3121 -patch

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



[issue15727] PyType_FromSpecWithBases tp_new bugfix

2012-09-09 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/issue15727
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15727] PyType_FromSpecWithBases tp_new bugfix

2012-09-09 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

Can you give an example of the situation that you described?  Perhaps you 
encountered it while refactoring some particular extension module.  Which?

In your patch new code is commented out.

PySpec_New() is not a good name.  It should be something like 
PyObject_FailingNew().

--
nosy: +belopolsky

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



[issue15727] PyType_FromSpecWithBases tp_new bugfix

2012-08-19 Thread Robin Schreiber

New submission from Robin Schreiber:

As with every type, that has been created and initialized, HeapTypes created 
form PyType_FromSpecWithBases() have to pass through PyType_Ready(). Here the 
function inherit_special might be called, which, among other things, does the 
following:

3892 if (base != PyBaseObject_Type ||  
  
3893 (type-tp_flags  Py_TPFLAGS_HEAPTYPE)) {
3894 if (type-tp_new == NULL)
3895 type-tp_new = base-tp_new;
3896 }

The code does not know of Heaptypes that have been created from extension-types 
by the PEP 384 refactorings. This includes extension-types that do not specify 
a tp_new method but instead have seperate factory methods, that are only used 
within the extension module. inherit_special() might consequently assign 
inappropriate new-methods to these type objects.

To circumvent this issue, I propose to enhance PyType_FromSpecWithBases in the 
following way: If no tp_new has been specified, we assign the newly defined 
PySpec_New() method to tp_new which simply denies the user to create an 
instance of this type. This also prohibits inherit_special to falsely inherit 
inappropriate new-methods.

--
components: Interpreter Core
files: PyType_FromSpecWithBases_tp_new_fix.patch
keywords: patch
messages: 168579
nosy: Robin.Schreiber, loewis
priority: normal
severity: normal
status: open
title: PyType_FromSpecWithBases tp_new bugfix
type: behavior
versions: Python 3.4
Added file: 
http://bugs.python.org/file26897/PyType_FromSpecWithBases_tp_new_fix.patch

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