pyo3 icon indicating copy to clipboard operation
pyo3 copied to clipboard

Improve native object initialization

Open mbway opened this issue 1 year ago • 1 comments

Before this change, classes inheriting the base object were constructed by using TP_ALLOC directly, obscuring the intention of PyNativeTypeInitializer, and inheriting from other base classes requires use of the unlimited API.

Previously this was not very limiting, but with https://github.com/PyO3/pyo3/pull/4678 it will be possible to inherit from native base classes with the limited API and possibly from dynamically imported native base classes which may require __new__ arguments to reach them.

mbway avatar Dec 14 '24 16:12 mbway

I don't think there is much I can do about the code coverage decreasing. Not sure how I would construct a type without the TP_NEW slot which would be required for testing the "cannot construct type that does not define __new__" error

mbway avatar Apr 18 '25 12:04 mbway