coady / multimethod

Multiple argument dispatching.
https://coady.github.io/multimethod
Other
277 stars 24 forks source link

Doesn't Work with namedtuple Python3.8 #7

Closed maxifom closed 4 years ago

maxifom commented 4 years ago

python --version Python 3.8.0 pip freeze multimethod==1.2 Test case:

from collections import namedtuple
from typing import List

from multimethod import multimethod

TestNamedTuple = namedtuple(
    'TestNamedTuple', ['a', 'b', 'c']
)

class TestClass(object):
    @multimethod
    def accept(self, items: List[TestNamedTuple]):
        pass

if __name__ == '__main__':
    a = TestClass()
    a.accept([TestNamedTuple("1", "1", "1"), TestNamedTuple("2", "2", "2")])

This outputs: RecursionError: maximum recursion depth exceeded while calling a Python object

coady commented 4 years ago

This is fixed already on master: d879956. Strings have to be special cased.

I think there's been enough fixes to warrant a release too.

coady commented 4 years ago

v1.3