@@ -674,7 +674,14 @@ def process_audit_events(app, doctree, fromdocname):
674
674
node .replace_self (table )
675
675
676
676
677
- def patch_pairindextypes (app ) -> None :
677
+ def patch_pairindextypes (app , _env ) -> None :
678
+ """Remove all entries from ``pairindextypes`` before writing POT files.
679
+
680
+ We want to run this just before writing output files, as the check to
681
+ circumvent is in ``I18nBuilder.write_doc()``.
682
+ As such, we link this to ``env-check-consistency``, even though it has
683
+ nothing to do with the environment consistency check.
684
+ """
678
685
if app .builder .name != 'gettext' :
679
686
return
680
687
@@ -688,14 +695,7 @@ def patch_pairindextypes(app) -> None:
688
695
# the Sphinx-translated pairindextypes values. As we intend to move
689
696
# away from this, we need Sphinx to believe that these values don't
690
697
# exist, by deleting them when using the gettext builder.
691
-
692
- pairindextypes .pop ('module' , None )
693
- pairindextypes .pop ('keyword' , None )
694
- pairindextypes .pop ('operator' , None )
695
- pairindextypes .pop ('object' , None )
696
- pairindextypes .pop ('exception' , None )
697
- pairindextypes .pop ('statement' , None )
698
- pairindextypes .pop ('builtin' , None )
698
+ pairindextypes .clear ()
699
699
700
700
701
701
def setup (app ):
@@ -719,7 +719,7 @@ def setup(app):
719
719
app .add_directive_to_domain ('py' , 'awaitablemethod' , PyAwaitableMethod )
720
720
app .add_directive_to_domain ('py' , 'abstractmethod' , PyAbstractMethod )
721
721
app .add_directive ('miscnews' , MiscNews )
722
- app .connect ('builder-inited ' , patch_pairindextypes )
722
+ app .connect ('env-check-consistency ' , patch_pairindextypes )
723
723
app .connect ('doctree-resolved' , process_audit_events )
724
724
app .connect ('env-merge-info' , audit_events_merge )
725
725
app .connect ('env-purge-doc' , audit_events_purge )
0 commit comments