8000 gh-85795: Add support for `super()` in `NamedTuple` subclasses by bswck · Pull Request #129352 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-85795: Add support for super() in NamedTuple subclasses #129352

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

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Reformat for optimal line length
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
  • Loading branch information
bswck and AlexWaygood committed Jan 29, 2025
commit ee93519bccb4914b41ab2c3b51fc3813edce693d
3 changes: 2 additions & 1 deletion Lib/collections/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ def __ror__(self, other):

_nmtuple_classcell_sentinel = object()

def _namedtuple(typename, field_names, *, rename=False, defaults=None, module=None, classcell=_nmtuple_classcell_sentinel):
def _namedtuple(typename, field_names, *, rename=False, defaults=None, module=None,
classcell=_nmtuple_classcell_sentinel):
# Validate the field names. At the user's option, either generate an error
# message or automatically replace the field name with a valid name.
if isinstance(field_names, str):
Expand Down
3 changes: 2 additions & 1 deletion Lib/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2929,7 +2929,8 @@ def __round__(self, ndigits: int = 0) -> T:
pass


def _make_nmtuple(name, fields, annotate_func, module, defaults = (), classcell=collections._nmtuple_classcell_sentinel):
def _make_nmtuple(name, fields, annotate_func, module, defaults = (),
classcell=collections._nmtuple_classcell_sentinel):
nm_tpl = collections._namedtuple(name, fields, defaults=defaults,
module=module, classcell=classcell)
nm_tpl.__annotate__ = nm_tpl.__new__.__annotate__ = annotate_func
Expand Down
Loading
0