Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

closes #10456: test and fix for sphinx.domain.python.filter_meta_fields() #10457

Merged
merged 5 commits into from May 22, 2022

Conversation

akruis
Copy link

@akruis akruis commented May 16, 2022

Feature or Bugfix

  • Bugfix

Purpose

  • Fix autodoc documentation with more that a single meta-field (i.e. :meta prublic: together with :meta hide-value:)

Detail

  • Test removal of meta-fields
  • Fix the faulty filter function

Relates

Anselm Kruis added 4 commits May 16, 2022 15:45
Add two meta-fields to an appropriate test case.
Currently the test fails, because of bug sphinx-doc#10456.
The next commit fixes the issue.
The function now removes all "meta"-fields from a field-list.
@AA-Turner
Copy link
Member

Could you explain why we need reversed and not just for ... in fields[:]:?

A

@tk0miya tk0miya changed the base branch from 5.x to 5.0.x May 22, 2022 04:19
@tk0miya tk0miya added this to the 5.0.0 milestone May 22, 2022
Copy link
Member

@tk0miya tk0miya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! It must be merged into the 5.0.0 release. So I'll move the CHANGES entry to 5.0.0 from now on.

@tk0miya tk0miya merged commit b36eaaf into sphinx-doc:5.0.x May 22, 2022
@akruis
Copy link
Author

akruis commented May 22, 2022

Could you explain why we need reversed and not just for ... in fields[:]:?

A

Without reversed the code would be more or less equivalent to

i=0
while i < len(fields):
  field = fields[i]
  if some_condition(field):
    del fields[i]
  i += 1

(Unfortunately this equivalence is a bit obfuscated. At runtime fields is node.) Now, if the code deletes field i, then the index of all following fields changes by -1 and if you increment i by one, you skip one field in the iteration.

@akruis akruis deleted the fix#10456 branch May 22, 2022 14:53
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants