Project-Platypus / Platypus

A Free and Open Source Python Library for Multiobjective Optimization
GNU General Public License v3.0
553 stars 152 forks source link

Tests fail on Python 3.11: `inspect.getargspec()` is removed in Python 3.11 #190

Closed EwoutH closed 1 year ago

EwoutH commented 1 year ago

Currently the tests fail on Python 3.11, because inspect.getargspec() was removed in Python 3.11:

AttributeError: module 'inspect' has no attribute 'getargspec'

This error happens here: https://github.com/Project-Platypus/Platypus/blob/62b5c23d2674839000388d463225224863d7b508/platypus/tools.py#L586-L596

For a replacement, there are two options:

inspect.getargspec(func) Deprecated since version 3.0: Use getfullargspec() for an updated API that is usually a drop-in replacement, but also correctly handles function annotations and keyword-only parameters.

Alternatively, use signature() and Signature Object, which provide a more structured introspection API for callables.