blob: 91e956b7819ea2b182b74ed31fc816247fd57620 [file] [log] [blame]
// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "pyobj.h"
namespace dctv {
PyObject*
tp_alloc_for_gc(PyTypeObject* type, Py_ssize_t n) noexcept
{
assert(PyType_IS_GC(type));
assert(n == 0);
return PyObject_GC_New(PyObject, type);
}
PyObject*
return_self(PyObject* obj) noexcept
{
return addref(obj).release();
}
} // namespace dctv