Skip to content

Commit

Permalink
Fix memory leak in TensorFromScalar
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonwillard committed Oct 25, 2023
1 parent ec4821e commit 49ae74e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions aesara/tensor/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,16 +577,15 @@ def c_code(self, node, name, inputs, outputs, sub):
return (
"""
%(z)s = (PyArrayObject*)PyArray_FromScalar(py_%(x)s, NULL);
if(py_%(z)s == NULL){
if(%(z)s == NULL){
%(fail)s;
}
Py_XINCREF(%(z)s);
"""
% locals()
)

def c_code_cache_version(self):
return (1,)
return (2,)


tensor_from_scalar = TensorFromScalar()
Expand Down

0 comments on commit 49ae74e

Please sign in to comment.