• Kirill Smelkov's avatar
    *: NULL/nullptr -> nil (C++ only) · fc1c3e24
    Kirill Smelkov authored
    Convert C++ part of the project to use nil instead of NULL/nullptr.
    
    We do not convert pyx part yet, because Cython currently does not
    understand that nullptr_t has properties of NULL and with e.g. the
    following change
    
        --- a/golang/_context.pyx
        +++ b/golang/_context.pyx
        @@ -116,7 +116,7 @@ cdef cppclass _PyValue (_interface, gobject) nogil:
             __dealloc__():
                 with gil:
                     obj = <object>this.pyobj
        -            this.pyobj = NULL
        +            this.pyobj = nil
                     Py_DECREF(obj)
    
    errors as
    
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
                if __decref():
                    del self
            __dealloc__():
                with gil:
                    obj = <object>this.pyobj
                    this.pyobj = nil
                                ^
        ------------------------------------------------------------
    
        golang/_context.pyx:119:25: Cannot assign type 'nullptr_t' to 'PyObject *'
    
    https://github.com/cython/cython/issues/3314
    fc1c3e24
libgolang_test.cpp 25 KB