forked from maxjhandsome/jittor
fix pyjt var leak
This commit is contained in:
parent
0c57b4e44b
commit
20a2f3d64c
|
@ -500,6 +500,7 @@ def compile_src(src, h, basename):
|
||||||
slot_name = None
|
slot_name = None
|
||||||
func_cast = ""
|
func_cast = ""
|
||||||
func_fill = ""
|
func_fill = ""
|
||||||
|
before_return = ""
|
||||||
if name == "__init__":
|
if name == "__init__":
|
||||||
slot_name = "tp_init"
|
slot_name = "tp_init"
|
||||||
func_head = "(PyObject* self, PyObject* _args, PyObject* kw) -> int"
|
func_head = "(PyObject* self, PyObject* _args, PyObject* kw) -> int"
|
||||||
|
@ -547,6 +548,7 @@ def compile_src(src, h, basename):
|
||||||
slot_name = "tp_dealloc"
|
slot_name = "tp_dealloc"
|
||||||
func_head = "(PyObject* self) -> void"
|
func_head = "(PyObject* self) -> void"
|
||||||
func_fill = "int64 n = 0"
|
func_fill = "int64 n = 0"
|
||||||
|
before_return = "Py_TYPE(self)->tp_free((PyObject *) self);"
|
||||||
|
|
||||||
elif name in binary_number_slots:
|
elif name in binary_number_slots:
|
||||||
slot_name = "tp_as_number->"+binary_number_slots[name]
|
slot_name = "tp_as_number->"+binary_number_slots[name]
|
||||||
|
@ -656,7 +658,7 @@ def compile_src(src, h, basename):
|
||||||
func_return_failed = "return -1"
|
func_return_failed = "return -1"
|
||||||
else:
|
else:
|
||||||
assert "-> void" in func_head
|
assert "-> void" in func_head
|
||||||
arr_func_return.append(f"{func_call};return")
|
arr_func_return.append(f"{func_call};{before_return}return")
|
||||||
func_return_failed = "return"
|
func_return_failed = "return"
|
||||||
# generate error msg when not a valid call
|
# generate error msg when not a valid call
|
||||||
error_log_code = generate_error_code_from_func_header(func_head, target_scope_name, name, dfs, basename ,h, class_info)
|
error_log_code = generate_error_code_from_func_header(func_head, target_scope_name, name, dfs, basename ,h, class_info)
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -21,7 +21,7 @@ with open(os.path.join(path, "README.md"), "r", encoding='utf8') as fh:
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name='jittor',
|
name='jittor',
|
||||||
version='1.1.4.6',
|
version='1.1.4.7',
|
||||||
# scripts=[],
|
# scripts=[],
|
||||||
author="Jittor Group",
|
author="Jittor Group",
|
||||||
author_email="ran.donglang@gmail.com",
|
author_email="ran.donglang@gmail.com",
|
||||||
|
|
Loading…
Reference in New Issue