@@ -679,7 +679,14 @@ def process_audit_events(app, doctree, fromdocname):
679679node .replace_self (table )
680680
681681
682- def patch_pairindextypes (app )-> None :
682+ def patch_pairindextypes (app ,_env )-> None :
683+ """Remove all entries from ``pairindextypes`` before writing POT files.
684+
685+ We want to run this just before writing output files, as the check to
686+ circumvent is in ``I18nBuilder.write_doc()``.
687+ As such, we link this to ``env-check-consistency``, even though it has
688+ nothing to do with the environment consistency check.
689+ """
683690if app .builder .name != 'gettext' :
684691return
685692
@@ -693,14 +700,7 @@ def patch_pairindextypes(app) -> None:
693700# the Sphinx-translated pairindextypes values. As we intend to move
694701# away from this, we need Sphinx to believe that these values don't
695702# exist, by deleting them when using the gettext builder.
696-
697- pairindextypes .pop ('module' ,None )
698- pairindextypes .pop ('keyword' ,None )
699- pairindextypes .pop ('operator' ,None )
700- pairindextypes .pop ('object' ,None )
701- pairindextypes .pop ('exception' ,None )
702- pairindextypes .pop ('statement' ,None )
703- pairindextypes .pop ('builtin' ,None )
703+ pairindextypes .clear ()
704704
705705
706706def setup (app ):
@@ -725,7 +725,7 @@ def setup(app):
725725app .add_directive_to_domain ('py' ,'awaitablemethod' ,PyAwaitableMethod )
726726app .add_directive_to_domain ('py' ,'abstractmethod' ,PyAbstractMethod )
727727app .add_directive ('miscnews' ,MiscNews )
728- app .connect ('builder-inited ' ,patch_pairindextypes )
728+ app .connect ('env-check-consistency ' ,patch_pairindextypes )
729729app .connect ('doctree-resolved' ,process_audit_events )
730730app .connect ('env-merge-info' ,audit_events_merge )
731731app .connect ('env-purge-doc' ,audit_events_purge )