> 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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4