@@ -679,7 +679,14 @@ def process_audit_events(app, doctree, fromdocname):
679
679
node .replace_self (table )
680
680
681
681
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
+ """
683
690
if app .builder .name != 'gettext' :
684
691
return
685
692
@@ -693,14 +700,7 @@ def patch_pairindextypes(app) -> None:
693
700
# the Sphinx-translated pairindextypes values. As we intend to move
694
701
# away from this, we need Sphinx to believe that these values don't
695
702
# 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 ()
704
704
705
705
706
706
def setup (app ):
@@ -725,7 +725,7 @@ def setup(app):
725
725
app .add_directive_to_domain ('py' , 'awaitablemethod' , PyAwaitableMethod )
726
726
app .add_directive_to_domain ('py' , 'abstractmethod' , PyAbstractMethod )
727
727
app .add_directive ('miscnews' , MiscNews )
728
- app .connect ('builder-inited ' , patch_pairindextypes )
728
+ app .connect ('env-check-consistency ' , patch_pairindextypes )
729
729
app .connect ('doctree-resolved' , process_audit_events )
730
730
app .connect ('env-merge-info' , audit_events_merge )
731
731
app .connect ('env-purge-doc' , audit_events_purge )
0 commit comments