Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Poor error message when TypeError is raised during dict construction #116436

Closed
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement
@hauntsaninja

Description

@hauntsaninja
~/dev/cpython main λ cat z.py import randomdef foo():    yield random.randint(100)  # oops, only passed in one argument    yield "value"dict([foo() for _ in range(3)])~/dev/cpython main λ python3.12 z.py                                                                   Traceback (most recent call last):  File "/Users/shantanu/dev/cpython/z.py", line 7, in <module>    dict([foo() for _ in range(3)])TypeError: cannot convert dictionary update sequence element #0 to a sequence

I'd expect something like what PyPy gives:

Traceback (most recent call last):  File "/Users/shantanu/dev/cpython/z.py", line 7, in <module>    dict([foo() for _ in range(3)])  File "/Users/shantanu/dev/cpython/z.py", line 4, in foo    yield random.randint(100)  # oops, only passed in one argument          ^^^^^^^^^^^^^^^^^^^TypeError: Random.randint() missing 1 required positional argument: 'b'

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp