Improve `__repr__` string of synchronize tools in the `multiprocessing` module.
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 77.2k
- Forks
- 35.9k
- Métricas de merge de PR
- Métricas de PR pendientes
Descripción
Feature or enhancement
Proposal:
To be consistant with representation string of threading sychronize tools and in accordance with the discussion from the #149447 PR , the missing id information must be added in the __repr__ of the following synchronization classes:
Lock,Rlock,Semaphore,BoundedSemaphore,Condition.
and refactoring must be performed to these 2 classes:
Event,Barrier.
See some examples below:
import threading
import multiprocessing
print(threading.Semaphore(3))
print(multiprocessing.Semaphore(3))
print(threading.Lock())
print(multiprocessing.Lock())
print(threading.Event())
print(multiprocessing.Event())
print(threading.Barrier(2))
print(multiprocessing.Barrier(2))
The ouput is:
<threading.Semaphore at 0x10378c8a0: value=3>
<Semaphore(value=3)>
<unlocked _thread.lock object at 0x103612040>
<Lock(owner=None)>
<threading.Event at 0x10378ccc0: unset>
<Event at 0x10378ccc0 unset>
<threading.Barrier at 0x10378ccc0: waiters=0/2>
<multiprocessing.synchronize.Barrier at 0x10378ccc0: waiters=0/2>
A PR will be published soon.
cc @gpshead
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
#149447
Linked PRs
- gh-155593
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza en el módulo multiprocessing con las clases Lock, Rlock, Semaphore, BoundedSemaphore, Condition, Event y Barrier, comparando sus representaciones con threading y con la discusión en #149447. Se considera terminado cuando se incluye la información de ID solicitada para las herramientas de sincronización enumeradas y Event y Barrier reciben la refactorización propuesta; ten en cuenta que PR #155593 ya está enlazado en el issue.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- operating-systems
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100