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

_overload_dummy raisesNotImplementedError, notRuntimeError#98351

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

sobolevn
Copy link
Member

Source:

cpython/Lib/typing.py

Lines 2536 to 2542 ineae7dad

def_overload_dummy(*args,**kwds):
"""Helper for @overload to raise when called."""
raiseNotImplementedError(
"You should not call an overloaded function. "
"A series of @overload-decorated functions "
"outside a stub module should always be followed "
"by an implementation that is not @overload-ed.")

I've found this while looking for implicit abstract classes / methods in CPython.

Test was checking forRuntimeError, it is technically correct:

>>>NotImplementedError.__mro__(<class'NotImplementedError'>,<class'RuntimeError'>,<class'Exception'>,<class'BaseException'>,<class'object'>)

But, we can be more precise. It is a good thing.
I am going to skip creating an issue for this, it is like a typo-fix :)

@bedevere-botbedevere-bot added awaiting review testsTests in the Lib/test dir labelsOct 17, 2022
@sobolevnsobolevn added skip issue skip news testsTests in the Lib/test dir awaiting review and removed testsTests in the Lib/test dir awaiting review labelsOct 17, 2022
@sobolevnsobolevn changed the title_overload_dummy raiseNotImplementedError, notRuntimeError_overload_dummy raisesNotImplementedError, notRuntimeErrorOct 17, 2022
Copy link
Member

@JelleZijlstraJelleZijlstra left a comment

Choose a reason for hiding this comment

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

Thanks for catching this!

I feel likeRuntimeError is a better exception to throw thanNotImplementedError here, but we've apparently always used NotImplementedError and it's not worth changing.

@JelleZijlstraJelleZijlstra merged commit1ca6647 intopython:mainOct 20, 2022
@miss-islington
Copy link
Contributor

Thanks@sobolevn for the PR, and@JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@miss-islington
Copy link
Contributor

Sorry,@sobolevn and@JelleZijlstra, I could not cleanly backport this to3.10 due to a conflict.
Please backport usingcherry_picker on command line.
cherry_picker 1ca6647f22794f0a0c982ecb03e764db76d51087 3.10

@bedevere-bot
Copy link

GH-98470 is a backport of this pull request to the3.11 branch.

@bedevere-botbedevere-bot removed the needs backport to 3.11only security fixes labelOct 20, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestOct 20, 2022
…ntimeError` (pythonGH-98351)(cherry picked from commit1ca6647)Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
@JelleZijlstraJelleZijlstra removed the needs backport to 3.10only security fixes labelOct 20, 2022
@JelleZijlstra
Copy link
Member

These tests don't exist in 3.10.

miss-islington added a commit that referenced this pull requestOct 20, 2022
…ntimeError` (GH-98351)(cherry picked from commit1ca6647)Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
carljm added a commit to carljm/cpython that referenced this pull requestOct 20, 2022
* main: (40 commits)pythongh-98461: Fix source location in comprehensions bytecode (pythonGH-98464)pythongh-98421: Clean Up PyObject_Print (pythonGH-98422)pythongh-98360: multiprocessing now spawns children on Windows with correct argv[0] in virtual environments (pythonGH-98462)  CODEOWNERS: Become a typing code owner (python#98480)  [doc] Improve logging cookbook example. (pythonGH-98481)  Add more tkinter.Canvas tests (pythonGH-98475)pythongh-95023: Added os.setns and os.unshare functions (python#95046)pythonGH-98363: Presize the list for batched() (pythonGH-98419)pythongh-98374: Suppress ImportError for invalid query for help() command. (pythongh-98450)  typing tests: `_overload_dummy` raises `NotImplementedError`, not `RuntimeError` (python#98351)pythongh-98354: Add unicode check for 'name' attribute in _imp_create_builtin (pythonGH-98412)pythongh-98257: Make _PyEval_SetTrace() reentrant (python#98258)pythongh-98414: py.exe launcher does not use defaults for -V:company/ option (pythonGH-98460)pythongh-98417: Store int_max_str_digits on the Interpreter State (pythonGH-98418)  Doc: Remove title text from internal links (python#98409)  [doc] Refresh the venv introduction documentation, and correct the statement about VIRTUAL_ENV (pythonGH-98350)  Docs: Bump sphinx-lint and fix unbalanced inline literal markup (python#98441)pythongh-92886: Replace assertion statements in `handlers.BaseHandler` to support running with optimizations (`-O`) (pythonGH-93231)pythongh-92886: Fix tests that fail when running with optimizations (`-O`) in `_test_multiprocessing.py` (pythonGH-93233)pythongh-92886: Fix tests that fail when running with optimizations (`-O`) in `test_py_compile.py` (pythonGH-93235)  ...
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@JelleZijlstraJelleZijlstraJelleZijlstra approved these changes

@gvanrossumgvanrossumgvanrossum approved these changes

@Fidget-SpinnerFidget-SpinnerFidget-Spinner approved these changes

Assignees

@JelleZijlstraJelleZijlstra

Labels
skip issueskip newstestsTests in the Lib/test dir
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

6 participants
@sobolevn@miss-islington@bedevere-bot@JelleZijlstra@gvanrossum@Fidget-Spinner

[8]ページ先頭

©2009-2025 Movatter.jp