I disagree with you on the harm point. Our legal system does too. Mental harms count. There are varieties of them that you are legally protected from. Work-context sexual offense is one of them.
Whether pycon is a professional context really depends on whose dime and at whose behest you are attending it, no? I don't know the details of this case. In any event, it's probable that PyCon has a harassment policy that could be interpreted as to bar sexual jokes around people who don't want to hear them, but I don't know for sure.