Skip to content

Commit

Permalink
Do not allow generator functions on param.Number
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Feb 9, 2024
1 parent 0d28576 commit cedb934
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions param/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@
Parameters and Parameterized classes.
"""

import numbers
import os.path
import sys
import collections
import copy
import glob
import re
import datetime as dt
import collections
import glob
import inspect
import numbers
import os.path
import pathlib
import re
import sys
import typing
import warnings

Expand Down Expand Up @@ -803,7 +804,7 @@ def _validate_bounds(self, val, bounds, inclusive_bounds):
)

def _validate_value(self, val, allow_None):
if (allow_None and val is None) or callable(val):
if (allow_None and val is None) or (callable(val) and not inspect.isgeneratorfunction(val)):
return

if not _is_number(val):
Expand Down

0 comments on commit cedb934

Please sign in to comment.