FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-159815: do not leave stale OpenSSL errors in `_hashlib` by picnixz · Pull Request #159816 · python/cpython · GitHub

Repository navigation

Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
Prev Previous commit
Next Next commit
add test
  • Loading branch information
picnixz committed Oct 20, 2026
commit 0a4837efce355c6b3a0578fcbb492c019a792795
12 changes: 12 additions & 0 deletions Lib/test/test_hashlib.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1440,6 +1440,18 @@ def scrypt(password=b"password", /, **kwargs):
MAX_DKLEN = ((1 << 32) - 1) * 32 # see RFC 7914
self.assertRaises(numeric_exc_types, scrypt, dklen=MAX_DKLEN + 1)

def test_scrypt_stale_openssl_error(self):
# gh-159815: a failed algorithm lookup must not leave an error in
# the OpenSSL error queue that a later unrelated failure reports.
def get_error_message():
with self.assertRaises(ValueError) as cm:
hashlib.scrypt(b'password', salt=b'salt', n=2, r=0, p=1)
return str(cm.exception)

expect = get_error_message()
self.assertRaises(ValueError, _hashlib.new, 'no_such_algorithm')
self.assertEqual(get_error_message(), expect)


@threading_helper.requires_working_threading()
class TestTSAN(unittest.TestCase):
Expand Down
Loading

Back | FazBrowse Home | New Git URL