My cockatiel will attack me when females of child-bearing age, are in the room. if I try to put him back in his cage. This doesn't happen with children or older post-menopausal women.
Other times he will sit on my shoulder or knee, or we play games, for hours without problems.