Skip to content

Commit 625cde9

Browse files
committed
modelcontext raises a TypeError if no model is found. Catch that.
1 parent 1ef552a commit 625cde9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pymc3/distributions/dist_math.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,12 @@ def bound(logp, *conditions, **kwargs):
7070
"""
7171

7272
# If called inside a model context, see if bounds check is disabled
73-
model = modelcontext(kwargs.get("model"))
74-
if model is not None and model.disable_bounds_check:
75-
return logp
73+
try:
74+
model = modelcontext(kwargs.get("model"))
75+
if model.disable_bounds_check:
76+
return logp
77+
except TypeError:
78+
pass
7679

7780
broadcast_conditions = kwargs.get("broadcast_conditions", True)
7881

0 commit comments

Comments
 (0)