Skip to content

test_zlib uses some very old random API #110332

Closed

Description

@sobolevn

Bug report

Here's the problematic code:

# Try 17K of data
# generate random data stream
try:
# In 2.3 and later, WichmannHill is the RNG of the bug report
gen = random.WichmannHill()
except AttributeError:
try:
# 2.2 called it Random
gen = random.Random()
except AttributeError:
# others might simply have a single RNG
gen = random
gen.seed(1)

It always fails with AttributeError, because random.WichmannHill() does not exist.

This is some old compatibility class that was removed a long time ago:

The attributes random.whseed and random.__whseed have no meaning for
  the new generator.  Code using these attributes should switch to a
  new class, random.WichmannHill which is provided for backward
  compatibility and to make an alternate generator available.

So, I propose to simplify this test.

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    testsTests in the Lib/test dir
    on Oct 4, 2023
  2. self-assigned this
    on Oct 4, 2023
  3. added 2 commits that reference this issue on Oct 4, 2023
  4. added a commit that references this issue on Oct 4, 2023
  5. added 2 commits that reference this issue on Oct 4, 2023
  6. added 2 commits that reference this issue on Oct 4, 2023
  7. AlexWaygood commented on Oct 4, 2023

    @AlexWaygood
    Member

    Thanks!

  8. added a commit that references this issue on Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions