Skip to content

Commit

Permalink
Fix extmatch negation case (#219)
Browse files Browse the repository at this point in the history
Fixes #218
  • Loading branch information
facelessuser committed May 15, 2024
1 parent df834c7 commit dd0b3c2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions docs/src/markdown/about/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 8.5.2

- **FIX**: Fix `pathlib` issue with inheritance on Python versions greater than 3.12.
- **FIX**: Fix `EXTMATCH` case with `!(...)` patterns.

## 8.5.1

- **FIX**: Fix issue with type check failure in `wcmatch.glob`.
Expand Down
4 changes: 4 additions & 0 deletions tests/test_fnmatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ class TestFnMatch:
['!(test)', 'abc', True, fnmatch.D | fnmatch.E],
['!(test)', '..', False, fnmatch.D | fnmatch.E],

# Negation list followed by extended list
['!(2)_@(foo|bar)', '1_foo', True, fnmatch.E],
['!(!(2|3))_@(foo|bar)', '2_foo', True, fnmatch.E],

# POSIX style character classes
['[[:alnum:]]bc', 'zbc', True, 0],
['[[:alnum:]]bc', '1bc', True, 0],
Expand Down
2 changes: 1 addition & 1 deletion wcmatch/__meta__.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,5 @@ def parse_version(ver: str) -> Version:
return Version(major, minor, micro, release, pre, post, dev)


__version_info__ = Version(8, 5, 1, "final")
__version_info__ = Version(8, 5, 2, "final")
__version__ = __version_info__._get_canonical()
3 changes: 2 additions & 1 deletion wcmatch/_wcparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,8 @@ def parse_extend(self, c: str, i: util.StringIter, current: list[str], reset_dot
extended.append(self._restrict_extended_slash())
extended.append(self.sep)
elif c == "|":
self.clean_up_inverse(extended, temp_inv_nest and self.inv_nest)
if self.inv_nest:
self.clean_up_inverse(extended, temp_inv_nest)
extended.append(c)
if temp_after_start:
self.set_start_dir()
Expand Down

0 comments on commit dd0b3c2

Please sign in to comment.