Skip to content

Replace deprecated os.path.commonprefix usage - #52

Closed
Rajeshwari2857 wants to merge 2 commits into
aboutcode-org:mainfrom
Rajeshwari2857:fix-commonprefix-deprecation
Closed

Rajeshwari2857 wants to merge 2 commits into
aboutcode-org:mainfrom
Rajeshwari2857:fix-commonprefix-deprecation

Conversation

@Rajeshwari2857

Copy link
Copy Markdown

No description provided.

@Rajeshwari2857
Rajeshwari2857 force-pushed the fix-commonprefix-deprecation branch from 892a506 to 1b48aba Compare October 20, 2026 19:34
Signed-off-by: Rajeshwariba Vaghela <r.vaghela2857@gmail.com>
Signed-off-by: Rajeshwariba Vaghela <r.vaghela2857@gmail.com>
@Rajeshwari2857
Rajeshwari2857 force-pushed the fix-commonprefix-deprecation branch from 1b48aba to 281738a Compare October 21, 2026 08:26
@Rajeshwari2857

Copy link
Copy Markdown
Author

Fixed #51.

Issue: os.path.commonprefix() is deprecated.

Problem: The problem is caused by os.path.commonprefix which is deprecated in Python 3.15.

Solution: I implemented a replacement commonprefix() function that preserves the existing behavior without relying on the deprecated API. The new implementation handles empty input, finds the smallest and largest strings using min() and max(), and compares their characters to determine the longest common leading substring.

I also added tests in tests/test_regexopt.py to verify the replacement's behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant