If a doctor is tired and sleepy, isn't patient safety compomised?

It may. Either physician or a nurse who work extended shifts there is always a possibility that patient care can be compromised. Lack of sleep, strenuous work, tiredness will result in inattention, frustration - all of these culminate in poor patient care.