Skip to content

bpo-33604: Raise TypeError on missing hmac arg.#16805

Merged
gpshead merged 4 commits into
python:masterfrom
gpshead:hmac-wart
Oct 18, 2019
Merged

bpo-33604: Raise TypeError on missing hmac arg.#16805
gpshead merged 4 commits into
python:masterfrom
gpshead:hmac-wart

Conversation

@gpshead

@gpshead gpshead commented Oct 15, 2019

Copy link
Copy Markdown
Member

Also updates the documentation to clarify the situation surrounding
the digestmod parameter that is required despite its position in the
argument list as of 3.8.0 as well as removing old python2 era
references to "binary strings".

We indavertently had this raise ValueError in 3.8.0 for the missing
arg. This is not considered an API change as no reasonable code would
be catching this missing argument error in order to handle it.

https://bugs.python.org/issue33604

Also updates the documentation to clarify the situation surrounding
the digestmod parameter that is required despite its position in the
argument list as of 3.8.0 as well as removing old python2 era
references to "binary strings".

We indavertently had this raise ValueError in 3.8.0 for the missing
arg.  This is not considered an API change as no reasonable code would
be catching this missing argument error in order to handle it.
@gpshead gpshead added type-bug An unexpected behavior, bug, or error docs Documentation in the Doc dir skip news needs backport to 3.8 labels Oct 15, 2019
@gpshead
gpshead requested a review from rhettinger October 15, 2019 16:38
@gpshead gpshead self-assigned this Oct 15, 2019
@gpshead gpshead removed the skip news label Oct 15, 2019

@tiran tiran left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The digestmod name must be a string or callable.

Comment thread Doc/library/hmac.rst Outdated
@bedevere-bot

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

@gpshead

gpshead commented Oct 15, 2019

Copy link
Copy Markdown
Member Author

I have made the requested changes; please review again.

@bedevere-bot

Copy link
Copy Markdown

Thanks for making the requested changes!

@tiran: please review the changes made to this pull request.

@bedevere-bot
bedevere-bot requested a review from tiran October 15, 2019 16:58
@tirkarthi

Copy link
Copy Markdown
Member

Does changing exception type between 3.8.0 and 3.8.1 needs a versionchanged directive note in doc or is NEWS entry sufficient for these cases?

@gpshead

gpshead commented Oct 15, 2019

Copy link
Copy Markdown
Member Author

I'm not adding a versionchanged because the exception type when an argument was missing doesn't really count as a meaningful logic part of the API. Nobody would be likely to ever call this, looking for that exception, and doing something else. arguments can be made in favor of both TypeError and ValueError, but TypeError is a bit more consistent with the intent so moving it to that seems better.

@gpshead
gpshead merged commit f33c57d into python:master Oct 18, 2019
@gpshead
gpshead deleted the hmac-wart branch October 18, 2019 03:30
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @gpshead for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

@bedevere-bot

Copy link
Copy Markdown

GH-16833 is a backport of this pull request to the 3.8 branch.

miss-islington added a commit that referenced this pull request Oct 18, 2019
Also updates the documentation to clarify the situation surrounding
the digestmod parameter that is required despite its position in the
argument list as of 3.8.0 as well as removing old python2 era
references to "binary strings".

We indavertently had this raise ValueError in 3.8.0 for the missing
arg.  This is not considered an API change as no reasonable code would
be catching this missing argument error in order to handle it.
(cherry picked from commit f33c57d)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
@bedevere-bot

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 FreeBSD CURRENT Shared 3.x has failed when building commit f33c57d.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/168/builds/1646) and take a look at the build logs.
  4. Check if the failure is related to this commit (f33c57d) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/168/builds/1646

Failed tests:

  • test__xxsubinterpreters

Failed subtests:

  • test_already_running - test.test__xxsubinterpreters.RunStringTests
  • test_subinterpreter - test.test__xxsubinterpreters.IsRunningTests
  • test_still_running - test.test__xxsubinterpreters.DestroyTests

Summary of the results of the build (if available):

== Tests result: FAILURE then FAILURE ==

398 tests OK.

10 slowest tests:

  • test_tools: 19 min 13 sec
  • test_lib2to3: 18 min 40 sec
  • test_multiprocessing_spawn: 17 min 17 sec
  • test_subprocess: 10 min 48 sec
  • test_multiprocessing_fork: 9 min 45 sec
  • test_pickle: 9 min 2 sec
  • test_capi: 8 min 56 sec
  • test_concurrent_futures: 7 min 48 sec
  • test_tokenize: 6 min 34 sec
  • test_multiprocessing_forkserver: 5 min 43 sec

1 test failed:
test__xxsubinterpreters

20 tests skipped:
test_dbm_gnu test_devpoll test_epoll test_gdb test_idle test_ioctl
test_msilib test_ossaudiodev test_spwd test_startfile test_tcl
test_tix test_tk test_ttk_guionly test_ttk_textonly test_turtle
test_winconsoleio test_winreg test_winsound test_zipfile64

1 re-run test:
test__xxsubinterpreters

Total duration: 1 hour 8 min

Click to see traceback logs
Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test__xxsubinterpreters.py", line 853, in test_already_running
    interpreters.run_string(self.id, 'print("spam")')
AssertionError: RuntimeError not raised


Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/threading.py", line 944, in _bootstrap_inner
    self.run()
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/threading.py", line 882, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test__xxsubinterpreters.py", line 51, in run
    interpreters.run_string(interp, dedent(f"""
RuntimeError: unrecognized interpreter ID 39
FAIL


Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/threading.py", line 944, in _bootstrap_inner
    self.run()
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/threading.py", line 882, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test__xxsubinterpreters.py", line 51, in run
    interpreters.run_string(interp, dedent(f"""
RuntimeError: interpreter already running
FAIL


Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/threading.py", line 944, in _bootstrap_inner
    self.run()
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/threading.py", line 882, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test__xxsubinterpreters.py", line 51, in run
    interpreters.run_string(interp, dedent(f"""
RuntimeError: unrecognized interpreter ID 39


Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test__xxsubinterpreters.py", line 763, in test_still_running
    interpreters.destroy(interp)
AssertionError: RuntimeError not raised


Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/threading.py", line 944, in _bootstrap_inner
    self.run()
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/threading.py", line 882, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test__xxsubinterpreters.py", line 51, in run
    interpreters.run_string(interp, dedent(f"""
RuntimeError: unrecognized interpreter ID 52
FAIL


Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test__xxsubinterpreters.py", line 492, in test_subinterpreter
    self.assertTrue(interpreters.is_running(interp))
AssertionError: False is not true


Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/threading.py", line 944, in _bootstrap_inner
    self.run()
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/threading.py", line 882, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test__xxsubinterpreters.py", line 51, in run
    interpreters.run_string(interp, dedent(f"""
RuntimeError: unrecognized interpreter ID 46

jacobneiltaylor pushed a commit to jacobneiltaylor/cpython that referenced this pull request Dec 5, 2019
Also updates the documentation to clarify the situation surrounding
the digestmod parameter that is required despite its position in the
argument list as of 3.8.0 as well as removing old python2 era
references to "binary strings".

We indavertently had this raise ValueError in 3.8.0 for the missing
arg.  This is not considered an API change as no reasonable code would
be catching this missing argument error in order to handle it.
stratakis pushed a commit to stratakis/cpython that referenced this pull request Dec 12, 2019
Also updates the documentation to clarify the situation surrounding
the digestmod parameter that is required despite its position in the
argument list as of 3.8.0 as well as removing old python2 era
references to "binary strings".

We indavertently had this raise ValueError in 3.8.0 for the missing
arg.  This is not considered an API change as no reasonable code would
be catching this missing argument error in order to handle it.
(cherry picked from commit f33c57d)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
Also updates the documentation to clarify the situation surrounding
the digestmod parameter that is required despite its position in the
argument list as of 3.8.0 as well as removing old python2 era
references to "binary strings".

We indavertently had this raise ValueError in 3.8.0 for the missing
arg.  This is not considered an API change as no reasonable code would
be catching this missing argument error in order to handle it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants