Author vstinner
Recipients christian.heimes, erlendaasland, pablogsal, serhiy.storchaka, shreyanavigyan, vstinner
Date 2021-04-30.23:00:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1619823650.97.0.117512006428.issue43916@roundup.psfhosted.org>
In-reply-to
Content
I checked " Types converted pre Python 3.9" and "Types converted in Python 3.9" of:
https://discuss.python.org/t/list-of-built-in-types-converted-to-heap-types/8403

(I didn't check "Types converted in Python 3.10" yet.)

These lists are not complete, for example select.kevent was not listed whereas it has a bug.


_struct.unpack_iterator can be modified to use Py_TPFLAGS_DISALLOW_INSTANTIATION: its tp_new method always raises an exception.


Bugs!

* select.kevent: BUG, use {Py_tp_new, PyType_GenericNew} slot which doesn't properly initialize kqueue_event_Object!

Need review:

* _ast.AST: use {Py_tp_new, PyType_GenericNew} and {Py_tp_init, ast_type_init} slots. What happens if tp_new is called without calling tp_init?

Implement tp_new (ok!):

* _abc._abc_data
* _json.Scanner
* _json.Encoder
* select.devpoll
* select.epoll
* select.kqueue
* _random.Random
* _struct.Struct 

Other cases (ok!):

* _ssl.SSLError inherits from OSError and reuses OSError structure (PyOSErrorObject): the inherited tp_new works as expected.
* select.poll: Py_TPFLAGS_DISALLOW_INSTANTIATION
History
Date User Action Args
2021-04-30 23:00:50vstinnersetrecipients: + vstinner, christian.heimes, serhiy.storchaka, pablogsal, erlendaasland, shreyanavigyan
2021-04-30 23:00:50vstinnersetmessageid: <1619823650.97.0.117512006428.issue43916@roundup.psfhosted.org>
2021-04-30 23:00:50vstinnerlinkissue43916 messages
2021-04-30 23:00:50vstinnercreate