2 ms·
Not hard. You can support 3 and 2 in the same file without much hassle. Practical example: https://github.com/zopefoundation/BTrees/blob/master/BTrees/_compat.
by throwawayish 10y ago
Not hard. You can support 3 and 2 in the same file without much hassle.
Practical example: https://github.com/zopefoundation/BTrees/blob/master/BTrees/_compat.h https://github.com/zopefoundation/BTrees/blob/master/BTrees/... https://github.com/zopefoundation/BTrees/blob/master/BTrees/BTreeModuleTemplate.c https://github.com/zopefoundation/BTrees/blob/master/BTrees/...
There are a couple #if PY3K, but not much, really.
I ported a bunch of extension modules, total a couple thousand LOC, and it was pretty much a matter of reading the docs (see guide at https://docs.python.org/3/howto/cporting.html https://docs.python.org/3/howto/cporting.html ) and adding a few #ifs. Total time maybe an hour or two.