Comment 8 for bug 2041407

Revision history for this message
Mateus Rodrigues de Morais (mateus-morais) wrote :

Given comment #1, would it be an option to invert the getattr logic instead, so that it tries readfp first and fallback to read_file, i.e. reader = getattr(parser, "readfp", parser.read_file)?

I think that would maintain compatibility when readfp is available and would fallback to read_file in 3.12, where only that is available.

I can submit a merge proposal.