Skip to content

bpo-36517: Raise error on multiple inheritance with NamedTuple #19363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Apr 4, 2020

@gvanrossum gvanrossum changed the title bpo-36517: Raise error on multiple inharitence with NamedTuple. bpo-36517: Raise error on multiple inheritance with NamedTuple Apr 4, 2020
Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LG!

Co-Authored-By: Ivan Levkivskyi <levkivskyi@gmail.com>
@serhiy-storchaka serhiy-storchaka merged commit a94e627 into python:master Apr 4, 2020
@serhiy-storchaka serhiy-storchaka deleted the typing-namedtuple-no-multiple-inheritance branch April 4, 2020 18:31
nhuet added a commit to nhuet/scikit-decide that referenced this pull request May 12, 2022
The error traceback:

/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/site-packages/discrete_optimization/tsp/tsp_model.py:267: in <module>
    class Point2D(Point, NamedTuple):
/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/typing.py:1929: in _namedtuple_mro_entries
    raise TypeError("Multiple inheritance with NamedTuple is not supported")
E   TypeError: Multiple inheritance with NamedTuple is not supported

Coming from python/cpython#19363

Potential solution: replace NamedTuple by Dataclass(frozen=True)
nhuet added a commit to nhuet/scikit-decide that referenced this pull request May 12, 2022
The error traceback:

/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/site-packages/discrete_optimization/tsp/tsp_model.py:267: in <module>
    class Point2D(Point, NamedTuple):
/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/typing.py:1929: in _namedtuple_mro_entries
    raise TypeError("Multiple inheritance with NamedTuple is not supported")
E   TypeError: Multiple inheritance with NamedTuple is not supported

Coming from python/cpython#19363

Potential solution: replace NamedTuple by Dataclass(frozen=True)
nhuet added a commit to nhuet/scikit-decide that referenced this pull request May 13, 2022
The error traceback:

/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/site-packages/discrete_optimization/tsp/tsp_model.py:267: in <module>
    class Point2D(Point, NamedTuple):
/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/typing.py:1929: in _namedtuple_mro_entries
    raise TypeError("Multiple inheritance with NamedTuple is not supported")
E   TypeError: Multiple inheritance with NamedTuple is not supported

Coming from python/cpython#19363

Potential solution: replace NamedTuple by Dataclass(frozen=True)
nhuet added a commit to nhuet/discrete-optimization that referenced this pull request Jun 27, 2022
The error traceback:

/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/site-packages/discrete_optimization/tsp/tsp_model.py:267: in <module>
    class Point2D(Point, NamedTuple):
/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/typing.py:1929: in _namedtuple_mro_entries
    raise TypeError("Multiple inheritance with NamedTuple is not supported")
E   TypeError: Multiple inheritance with NamedTuple is not supported

Coming from python/cpython#19363

Potential solution: replace NamedTuple by Dataclass(frozen=True)
nhuet added a commit to nhuet/discrete-optimization that referenced this pull request Jun 27, 2022
The error traceback:

/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/site-packages/discrete_optimization/tsp/tsp_model.py:267: in <module>
    class Point2D(Point, NamedTuple):
/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/typing.py:1929: in _namedtuple_mro_entries
    raise TypeError("Multiple inheritance with NamedTuple is not supported")
E   TypeError: Multiple inheritance with NamedTuple is not supported

Coming from python/cpython#19363

Potential solution: replace NamedTuple by Dataclass(frozen=True)
nhuet added a commit to nhuet/discrete-optimization that referenced this pull request Jun 27, 2022
The error traceback:

/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/site-packages/discrete_optimization/tsp/tsp_model.py:267: in <module>
    class Point2D(Point, NamedTuple):
/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/typing.py:1929: in _namedtuple_mro_entries
    raise TypeError("Multiple inheritance with NamedTuple is not supported")
E   TypeError: Multiple inheritance with NamedTuple is not supported

Coming from python/cpython#19363

Potential solution: replace NamedTuple by Dataclass(frozen=True)
nhuet added a commit to nhuet/discrete-optimization that referenced this pull request Jun 27, 2022
The error traceback:

/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/site-packages/discrete_optimization/tsp/tsp_model.py:267: in <module>
    class Point2D(Point, NamedTuple):
/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/typing.py:1929: in _namedtuple_mro_entries
    raise TypeError("Multiple inheritance with NamedTuple is not supported")
E   TypeError: Multiple inheritance with NamedTuple is not supported

Coming from python/cpython#19363

Potential solution: replace NamedTuple by Dataclass(frozen=True)
nhuet added a commit to nhuet/discrete-optimization that referenced this pull request Jun 28, 2022
The error traceback:

/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/site-packages/discrete_optimization/tsp/tsp_model.py:267: in <module>
    class Point2D(Point, NamedTuple):
/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/typing.py:1929: in _namedtuple_mro_entries
    raise TypeError("Multiple inheritance with NamedTuple is not supported")
E   TypeError: Multiple inheritance with NamedTuple is not supported

Coming from python/cpython#19363

Potential solution: replace NamedTuple by Dataclass(frozen=True)
nhuet added a commit to nhuet/discrete-optimization that referenced this pull request Jun 28, 2022
The error traceback:

/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/site-packages/discrete_optimization/tsp/tsp_model.py:267: in <module>
    class Point2D(Point, NamedTuple):
/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/typing.py:1929: in _namedtuple_mro_entries
    raise TypeError("Multiple inheritance with NamedTuple is not supported")
E   TypeError: Multiple inheritance with NamedTuple is not supported

Coming from python/cpython#19363

Potential solution: replace NamedTuple by Dataclass(frozen=True)
nhuet added a commit to nhuet/discrete-optimization that referenced this pull request Jun 28, 2022
The error traceback:

/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/site-packages/discrete_optimization/tsp/tsp_model.py:267: in <module>
    class Point2D(Point, NamedTuple):
/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/typing.py:1929: in _namedtuple_mro_entries
    raise TypeError("Multiple inheritance with NamedTuple is not supported")
E   TypeError: Multiple inheritance with NamedTuple is not supported

Coming from python/cpython#19363

Potential solution: replace NamedTuple by Dataclass(frozen=True)
tonio-m added a commit to tonio-m/fsql that referenced this pull request Aug 10, 2022
remove double inheritance with NamedTuple to avoid TypeError, as per python 3.9: 
python/cpython#19363
gmgunter added a commit to isce-framework/isce3 that referenced this pull request May 1, 2025
This doesn't work in Python >=3.9 until Python 3.11. Multiple
inheritance with `NamedTuple` has limited support.

See:

* python/cpython#19363
* python/cpython#88089
* python/cpython#92027
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants