pyo3
pyo3 copied to clipboard
Use disallow instantiation flag for classes without the __new__ method
Starting from Py 3.10 it's possible to prohibit instantiation by using Py_TPFLAGS_DISALLOW_INSTANTIATION
flag instead of using a stub method.
From the Python side it makes it clear if there is no __new__
attr on a class then it can't be instantiated.