Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: pytest-dev/iniconfig
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.2.0
Choose a base ref
...
head repository: pytest-dev/iniconfig
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.3.0
Choose a head ref
  • 4 commits
  • 4 files changed
  • 2 contributors

Commits on Oct 18, 2025

  1. Add IniConfig.parse() classmethod to fix inline comment handling

    Fixes #55 - Inline comments were incorrectly included in parsed values
    
    The bug: Inline comments (# or ;) were being included as part of values
    instead of being stripped, inconsistent with how section comments are handled.
    
    Example of the bug:
      name = value # comment
      Result was: "value # comment" (incorrect)
      Should be: "value" (correct)
    
    Changes:
    - Add IniConfig.parse() classmethod with strip_inline_comments parameter
      - Default: strip_inline_comments=True (correct behavior - strips comments)
      - Can set strip_inline_comments=False if old buggy behavior needed
    - IniConfig() constructor preserves old behavior for backward compatibility
      (calls parse_ini_data with strip_inline_comments=False)
    - Add parse_ini_data() helper in _parse.py to avoid code duplication
    - Update _parseline() to support strip_inline_comments parameter
    - Add comprehensive tests for both correct and legacy behavior
    
    Backward compatibility: Existing code using IniConfig() continues to work
    unchanged. Users should migrate to IniConfig.parse() for correct behavior.
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    RonnyPfannschmidt and claude committed Oct 18, 2025
    Configuration menu
    Copy the full SHA
    e2d89f5 View commit details
    Browse the repository at this point in the history
  2. Add strip_section_whitespace parameter to address issue #4

    Add opt-in Unicode whitespace stripping for section names (issue #4)
    
    Changes:
    - Add strip_section_whitespace parameter to IniConfig.parse()
      - Default: False (preserves backward compatibility)
      - When True: strips Unicode whitespace from section names
    - Document Unicode whitespace handling in CHANGELOG
      - Python 3's str.strip() has handled Unicode since Python 3.0 (2008)
      - iniconfig 2.0.0+ benefits from this automatically
      - Values and key names already strip Unicode whitespace correctly
    - Add tests for Unicode whitespace handling
    
    Background:
    Since iniconfig moved to Python 3 only in version 2.0.0, all strings are
    Unicode by default. Python 3's str.strip() handles Unicode whitespace
    characters (NO-BREAK SPACE, EN QUAD, IDEOGRAPHIC SPACE, etc.) automatically.
    This addresses the core concern in issue #4 for values and key names.
    
    The new strip_section_whitespace parameter provides opt-in stripping for
    section names, which were not previously stripped for backward compatibility.
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    RonnyPfannschmidt and claude committed Oct 18, 2025
    Configuration menu
    Copy the full SHA
    6d0af45 View commit details
    Browse the repository at this point in the history
  3. Refactor: Simplify IniConfig constructor and parse() method

    Consolidate __init__ to accept optional _sections and _sources parameters,
    allowing parse() to simply call the constructor.
    
    Changes:
    - Add _sections and _sources optional parameters to __init__
    - Compute sections and sources first, then assign once to Final attributes
    - When pre-parsed data provided, use it directly (called from parse())
    - Otherwise, parse the data normally (backward compatible path)
    - Simplify parse() to just call constructor with pre-parsed data
    
    This makes the code cleaner and easier to understand while maintaining
    the exact same functionality and backward compatibility.
    
    All 49 tests pass.
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    RonnyPfannschmidt and claude committed Oct 18, 2025
    Configuration menu
    Copy the full SHA
    58c0869 View commit details
    Browse the repository at this point in the history
  4. Merge pull request #70 from RonnyPfannschmidt/comments

    Add IniConfig.parse() with inline comment stripping and Unicode whitespace handling
    RonnyPfannschmidt authored Oct 18, 2025
    Configuration menu
    Copy the full SHA
    7faed13 View commit details
    Browse the repository at this point in the history
Loading