Skip to content

Commit 0703d54

Browse files
committed
update
1 parent 5099a1b commit 0703d54

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

python/uuid_utils/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
UUID,
1616
__version__,
1717
getnode,
18-
reseed as reseed_rng,
1918
uuid1,
2019
uuid3,
2120
uuid4,
@@ -24,10 +23,14 @@
2423
uuid7,
2524
uuid8,
2625
)
26+
from ._uuid_utils import (
27+
reseed as reseed_rng,
28+
)
2729

2830
# Reseed the RNG in the child process after a fork.
2931
# Otherwise both parent and child processes may generate the same UUIDs for some time.
30-
os.register_at_fork(after_in_child=reseed_rng)
32+
if hasattr(os, "fork"):
33+
os.register_at_fork(after_in_child=reseed_rng)
3134

3235
__all__ = [
3336
"MAX",

tests/test_uuid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def test_getnode() -> None:
208208

209209

210210
@pytest.mark.skipif(sys.platform == "win32", reason="Does not run on Windows")
211-
def test_reseed_rng_is_called_with_fork() -> None:
211+
def test_reseed_is_called_when_forking() -> None:
212212
read_end, write_end = os.pipe()
213213
uuid_utils.uuid4()
214214

0 commit comments

Comments
 (0)