GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Do not leave stale OpenSSL errors in `_hashlib` · Issue #159815 · python/cpython

Do not leave stale OpenSSL errors in _hashlib #159815

New issue
Copy link
New issue
Copy link
Open
Open
Do not leave stale OpenSSL errors in _hashlib#159815
Copy link
Assignees
picnixz
Labels
3.15bugs and security fixesbugs and security fixes3.16new features, bugs and security fixesnew features, bugs and security fixesextension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@picnixz
picnixz
opened on Oct 19, 2026
Issue body actions

Bug report

raise_unsupported_algorithm_impl() peeks the OpenSSL error queue but does not clear it on the ERR_R_UNSUPPORTED and ERR_R_FETCH_FAILED branches. Only the default: branch clears it, via raise_ssl_error_f(). The leftover entry is then reported by the next unrelated failure in the same thread:

>>> import _hashlib
>>> _hashlib.scrypt(b"", salt=b"", n=1024, r=0, p=1)
ValueError: invalid parameter combination for n, r, p, and maxmem
>>> _hashlib.new("no_such_algorithm_xyz")
UnsupportedDigestmodError: [digital envelope routines] unsupported hash algorithm no_such_algorithm_xyz
>>> _hashlib.scrypt(b"", salt=b"", n=1024, r=0, p=1)
ValueError: [digital envelope routines] unsupported

get_asn1_utf8name_by_nid() has the same problem. It decides whether to fall back to the short name based on ERR_peek_last_error(), so a leftover error could make it raise instead of falling back.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

  • gh-159815: do not leave stale OpenSSL errors in _hashlib #159816

Activity

  1. picnixz
    self-assigned this
    on Oct 19, 2026
  2. picnixz
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    extension-modulesC modules in the Modules dirC modules in the Modules dir
    on Oct 19, 2026
  3. picnixz
    added a parent issue on Oct 19, 2026
    • Meta-issue for bugs in cryptographic extension modules #155438
  4. picnixz
    added
    3.15bugs and security fixesbugs and security fixes
    3.16new features, bugs and security fixesnew features, bugs and security fixes
    on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @picnixz
    picnixz

Labels

3.15bugs and security fixesbugs and security fixes3.16new features, bugs and security fixesnew features, bugs and security fixesextension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.