lettura http://bugs.python.org/msg160297, posso vedere un semplice script scritto da Stephen White che dimostra come pitone threading bugs su con questa eccezioneCapire bug pitone filettatura
Exception AttributeError: AttributeError("'_DummyThread' object has no attribute '_Thread__block'",) in <module 'threading'
Dato il codice sorgente di Stephen White (http: //bugs.python .org/file25511/bad-thread.py),
import os
import thread
import threading
import time
def t():
threading.currentThread() # Populate threading._active with a DummyThread
time.sleep(3)
thread.start_new_thread(t,())
time.sleep(1)
pid = os.fork()
if pid == 0:
os._exit(0)
os.waitpid(pid, 0)
come potremmo riscrivere in modo che questo errore è stato risolto?
Mi sembra che tu possa riscrivere tutto come 'time.sleep (3)'. Penso che dovresti specificare cosa dovrebbero fare effettivamente i programmi riscritti. –
@JanneKarila Il programma mostra semplicemente un bug Python, che vedrai se lo esegui in Python 2.7. La richiesta è di aggirare il bug senza eseguire l'aggiornamento a una versione di Python che lo corregge. – user4815162342