Skip to content

Commit 1e7a65f

Browse files
committed
chore(backport): ignore family= for histogram
1 parent d79f955 commit 1e7a65f

File tree

1 file changed

+9
-0
lines changed
  • src/boost_histogram/_internal

1 file changed

+9
-0
lines changed

src/boost_histogram/_internal/hist.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ class Histogram(object):
9999
)
100100
# .metadata and ._variance_known are part of the dict
101101

102+
def __init_subclass__(cls, family=None):
103+
"""
104+
# Backported from 1.0. No effect on Python 2, so ignored. Allows _just_
105+
# histogram to be subclassed from both versions of boost-histogram. Subclassing
106+
anything else will not work in both 1.x and 0.x.
107+
"""
108+
if sys.version_info >= (3,):
109+
super(Histogram, cls).__init_subclass__()
110+
102111
@inject_signature(
103112
"self, *axes, storage=Double(), metadata=None", locals={"Double": Double}
104113
)

0 commit comments

Comments
 (0)