classification
Title: PEP 3121 --- PyType_Copy is missing
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.0
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: loewis Nosy List: _doublep, belopolsky, benjamin.peterson, loewis, petr.viktorin, pitrou, terry.reedy
Priority: normal Keywords:

Created on 2008-09-02 19:22 by _doublep, last changed 2020-10-23 18:27 by petr.viktorin. This issue is now closed.

Messages (5)
msg72362 - (view) Author: Paul Pogonyshev (_doublep) Date: 2008-09-02 19:22
PEP 3121 at python.org mentions PyType_Copy().  However, it doesn't seem
to be present in SVN version and there is no apparent replacement. 
Please clarify how types should be created for different module
instances --- if just sharing is fine, or should some copying (which
function?) be used.
msg72749 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-09-07 19:28
The intention is that different interpreters have distinct, separate
instances of the type objects. This is desirable in case of class
variables, and standard for Python-defined types. Clearly, 3.0 won't
provide that separation for many of the builtin types (and never may);
for out-of-core types, it is really the choice of the module designer.

I forgot to implement PyType_Copy; it is meant to create a new type
object which is a field-by-field copy. It's now too late to add it to
3.0; extension authors requiring it now should include it's source code
(which is currently not even written - contributions are welcome).

Reconsidering it: what should it do to the base types? 
 a) just incref tp_base and clone tp_bases, 
 b) offer an optional parameter to specify an alternative base object, 
 c) offer an optional parameter to specify an alternative bases tuple.
msg379368 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-10-22 21:50
12 years later there still is no PyType_Copy, at least not by that name, according to the doc index. So it is either not urgently needed or the need has been covered by other additions. I think that this should be closed as out of date and any new additions should be done in the light of the current situation.
msg379372 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-10-22 22:08
Zach Ware agreed on a coredev sprint discussion.
msg379463 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2020-10-23 18:27
The need is covered by PEP 384's PyType_FromSpec (and later additions, the latest being PyType_FromModuleAndSpec).

Thanks for closing!
History
Date User Action Args
2020-10-23 18:27:24petr.viktorinsetnosy: + petr.viktorin
messages: + msg379463
2020-10-22 22:08:10terry.reedysetstatus: open -> closed
resolution: out of date
messages: + msg379372

stage: resolved
2020-10-22 21:50:39terry.reedysetnosy: + terry.reedy
messages: + msg379368
2012-08-27 03:25:24belopolskysetnosy: + belopolsky
2009-02-15 15:05:59pitrousetnosy: + pitrou, benjamin.peterson
2008-09-07 19:28:35loewissetpriority: high -> normal
messages: + msg72749
2008-09-02 21:51:46benjamin.petersonsetpriority: high
assignee: loewis
nosy: + loewis
2008-09-02 19:22:23_doublepcreate