I'm trying to define a new python type object using the documentation found here https://docs.python.org/3/extending/newtypes.html. At the moment I am just following the basics section defining a new type with the same names as used in the documentation. I am then embedding the python interpreter within a simple application by calling PyImport_AppendInittab("noddy", &PyInit_noddy);
followed by Py_Initialize();
and then I am running a simple python script using PyRun_SimpleString(script);
where "script" is actually the following
import noddy
mytest = noddy.Noddy()
which is within the documentation as an example of creating an object of the new extended type. The problem I am having is that this produces an error
TypeError: cannot create 'noddy.Noddy' instances
What am I doing wrong here? I appreciate I have not provided any source code but I have simply copied the example from the documentation. I understand what each part is doing but I cannot find a problem. The module called noddy is created, the Noddy object is added so why can I not create a noddy.Noddy()
object as stated in the documentation?