diff --git a/doc/progress.rst b/doc/progress.rst index 6bbd66f51..b8e6864a8 100644 --- a/doc/progress.rst +++ b/doc/progress.rst @@ -8,11 +8,12 @@ Changelog 0.13.0 ~~~~~~ - * MAINT#1104: Fix outdated docstring for ``list_task``. * FIX#1030: ``pre-commit`` hooks now no longer should issue a warning. + * FIX#1058, #1100: Avoid ``NoneType`` error when printing task without ``class_labels`` attribute. * FIX#1110: Make arguments to ``create_study`` and ``create_suite`` that are defined as optional by the OpenML XSD actually optional. * FIX#1147: ``openml.flow.flow_exists`` no longer requires an API key. * MAIN#1088: Do CI for Windows on Github Actions instead of Appveyor. + * MAINT#1104: Fix outdated docstring for ``list_task``. * MAIN#1146: Update the pre-commit dependencies. * ADD#1103: Add a ``predictions`` property to OpenMLRun for easy accessibility of prediction data. diff --git a/openml/tasks/task.py b/openml/tasks/task.py index 095730645..14a85357b 100644 --- a/openml/tasks/task.py +++ b/openml/tasks/task.py @@ -97,7 +97,7 @@ def _get_repr_body_fields(self) -> List[Tuple[str, Union[str, int, List[str]]]]: fields["Estimation Procedure"] = self.estimation_procedure["type"] if getattr(self, "target_name", None) is not None: fields["Target Feature"] = getattr(self, "target_name") - if hasattr(self, "class_labels"): + if hasattr(self, "class_labels") and getattr(self, "class_labels") is not None: fields["# of Classes"] = len(getattr(self, "class_labels")) if hasattr(self, "cost_matrix"): fields["Cost Matrix"] = "Available"