bpo-36517: Raise error on multiple inheritance with NamedTuple by serhiy-storchaka · Pull Request #19363 · python/cpython

@serhiy-storchaka

@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

ilevkivskyi

@serhiy-storchaka @ilevkivskyi

Co-Authored-By: Ivan Levkivskyi <levkivskyi@gmail.com>

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)

@kinow kinow mentioned this pull request

Jun 29, 2022

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

gmgunter added a commit to isce-framework/isce3 that referenced this pull request

Aug 18, 2025
…rid (MCR #90132) (#99)

* Add bindings for `GLOBAL_MIN_HEIGHT` and `GLOBAL_MAX_HEIGHT`

Expose the C++ constants `isce3::core::GLOBAL_MIN_HEIGHT` and
`isce3::core::GLOBAL_MAX_HEIGHT` to Python.

* Add function to compute radar grid spanning a geo grid

* Simplify radar grid construction by ignoring grid coordinate conventions

See the discussion on this comment:
https://github-fn.jpl.nasa.gov/isce-3/isce/pull/2097#discussion_r26503

* Un-parameterize `Rectangle`

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

* Add `look_side` to be a string

* Simplify error messages

* Rename inner function to avoid name ambiguity

* Fix test regexes

* Add test cases for antimeridian and pole crossing

* Explain dummy parameter values used in test

* Test `get_bounding_rectangle()` with +/-inf

* Rename inner function to avoid name ambiguity

* Update docstrings

* Swap inner/outer loop order

* Specify default geo2rdr tolerance

* Clarify isce3 projection description