Sat, 08 Oct 2016 22:44:02 +0200 parsers: use PyVarObject_HEAD_INIT
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 08 Oct 2016 22:44:02 +0200] rev 30103
parsers: use PyVarObject_HEAD_INIT The macro changed slightly in Python 3, introducing curly brackets that somehow confuse Clang into issuing a ton of compiler warnings. Using PyVarObject_HEAD_INIT makes these go away. It's worth noting that the code is identical: the 2nd argument to PyVarObject_HEAD_INIT is assigned to the ob_size field and is inserted immediately after "PyObject_HEAD_INIT(type)" is generated. Compilers are weird.
Sat, 08 Oct 2016 22:21:22 +0200 pathencode: use Py_SIZE directly
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 08 Oct 2016 22:21:22 +0200] rev 30102
pathencode: use Py_SIZE directly On Python 2, PyBytes_GET_SIZE is the same as PyString_GET_SIZE which is the same as Py_SIZE which resolves to a struct member. On Python 3, PyBytes_GET_SIZE is "(assert(PyBytes_Check(op)),Py_SIZE(op))". The compiler barfs when assigning to this version. This patch simply changes PyBytes_GET_SIZE to Py_SIZE. On Python 2, there is no effective change in behavior. On Python 3, we drop the PyBytes_Check(). However, in all cases we have explicitly created a PyBytesObject in the same function, so the PyBytes_Check() is guaranteed to be true. Despite this, code changes over time, so I've added added assert() in all callers so we can catch this in debug builds. With this patch, all mercurial.* C extensions now compile on Python 3 on my OS X machine. There are several compiler warnings and I'm sure there are incompatibilities with Python 3, including possibly segfaults. But it is a milestone.
Sat, 08 Oct 2016 22:04:56 +0200 util: remove PyString* aliases on Python 3
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 08 Oct 2016 22:04:56 +0200] rev 30101
util: remove PyString* aliases on Python 3 We no longer have any users of the legacy PyString* functions. We no longer need these redefinitions. After this change, the only reference to "PyString" in the repo is in watchman's C extension. That isn't our code and porting Mercurial extensions to Python 3 is not a high priority at the moment. watchman's C extension will be dealt with later.
Sat, 08 Oct 2016 22:02:29 +0200 parsers: convert PyString* to PyBytes*
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 08 Oct 2016 22:02:29 +0200] rev 30100
parsers: convert PyString* to PyBytes* With this change, we no longer have any occurrences of "PyString" in our C extensions.
(0) -30000 -10000 -3000 -1000 -300 -100 -30 -10 -4 +4 +10 +30 +100 +300 +1000 +3000 +10000 tip