Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Multiprocessing Lock and RLock - invalid representation string on MacOSX. #125679

Closed
Assignees
gpshead
Labels
stdlibStandard Library Python modules in the Lib/ directorytopic-multiprocessingtype-bugAn unexpected behavior, bug, or error
@YvesDup

Description

@YvesDup

Bug report

Bug description:

Due of absence of thesem_getvalue C function in the MacOSX semaphore implementation,Lock andRLock representation strings are invalid in themultiprocessing module.

Call toself._semlock._get_value() raises an exception, and set part of repr with'unknown'.

importmultiprocessingasmpprint(mp.Lock()#  <Lock(owner=unknown)> vs <Lock(owner=None)> on Linuxprint(mp.RLockj())#  <RLock(unknown, unknown)> vs <RLock(None, 0)> on Linux

I propose to replace in the__repr__ method of each class the following test:

elifself._semlock._get_value()==1:

elifself._semlock._get_value()==1:

withelif not self._semlock._is_zero():.

This method is available and valid on each OS.

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Assignees

Labels

stdlibStandard Library Python modules in the Lib/ directorytopic-multiprocessingtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp