Fix maximum recursion depth error when generating documentation

Troubleshooting an issue with Senlin documentation,

> RecursionError: maximum recursion depth exceeded in __instancecheck__

it turns out that attrs['base_options'] creates a recursive reference
when no base classes have 'base_options'.
This happens when BaseAction is created.

Closes-Bug: #1955773
Change-Id: I2724f07339134b3e06b7ea925939bf7072162106
This commit is contained in:
Erik Olof Gunnar Andersson 2021-12-17 18:32:03 -08:00 committed by Akihiro Motoki
parent fc10126281
commit b8cc0043d4

View File

@ -52,7 +52,10 @@ class BaseActionMetaClass(type):
# Options of action are set as class attributes, loading them. # Options of action are set as class attributes, loading them.
options = {} options = {}
if attrs: if attrs:
options = attrs # NOTE: It is required to create a new dict object
# to avoid a recursive reference when no parent class
# has 'base_options' attribute.
options = dict(attrs)
# Iterate in reverse to preserve final order # Iterate in reverse to preserve final order
for base in bases[::-1]: for base in bases[::-1]: