> In an ideal world, developers would add that code to their > extensions right away. In the real world, where developers only > have limited resources available, you'll get more 3.x ports > by making such ports as painless as possible while at the > same time not forcing them to alienate their 2.x user base.
Unfortunately, such 3.x code would be full of bugs. >> For another example, >> >> long foo = PyInt_AsLong(Foo); >> >> has a hidden error in 3.x, with intobject: PyLong_AsLong might >> overflow, which the 2.x case doesn't. > > That's not quite true: PyInt_AsLong(obj) will try the > nb_int slot on non-integer objects which can return errors > (it returns -1 and sets the error message). However, the 2.x code will typically assume that the object is an int object, in which case PyInt_AsLong can never fail. So with intobject.h, the code will happily compile, but then fail to detect an exception at run-time - causing other difficult-to-find bugs. Regards, Martin _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com