python: fix to_parity default option handling

* python/spot/__init__.py (to_options): Do not have options
explicitely default to to_parity_options(), because that would be
instantiated only once.
This commit is contained in:
Alexandre Duret-Lutz 2020-04-18 00:30:25 +02:00
parent fd0d752bc3
commit ed5cccba8a

View file

@ -1292,7 +1292,7 @@ class scc_and_mark_filter:
self.restore_acceptance() self.restore_acceptance()
def to_parity(aut, options = to_parity_options(), **kwargs): def to_parity(aut, options = None, **kwargs):
"""Convert aut into a parity acceptance. """Convert aut into a parity acceptance.
This procedure combines multiple strategies to attempt to This procedure combines multiple strategies to attempt to
@ -1306,6 +1306,10 @@ def to_parity(aut, options = to_parity_options(), **kwargs):
Note that if you pass both your own options object and kwargs, Note that if you pass both your own options object and kwargs,
options will be updated in place. options will be updated in place.
""" """
if options is None:
# Can't make this a default option, otherwise the default
# instance would be updated by the kwargs.
options = to_parity_options()
if kwargs: if kwargs:
for key,val in to_parity_options.__dict__.items(): for key,val in to_parity_options.__dict__.items():
if not key.startswith('_') and key != "thisown" and key in kwargs: if not key.startswith('_') and key != "thisown" and key in kwargs: