[PR #104] [MERGED] [python] fix compatibility_test.py with Python 3 #710

Open
opened 2026-01-29 20:50:28 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/google/brotli/pull/104
Author: @anthrotype
Created: 5/8/2015
Status: Merged
Merged: 5/8/2015
Merged by: @szabadka

Base: masterHead: py3split


📝 Commits (1)

  • e6913b2 [python] use built-in split instead of 'string' module for py23

📊 Changes

1 file changed (+1 additions, -2 deletions)

View changed files

📝 python/tests/compatibility_test.py (+1 -2)

📄 Description

the compatibility_test.py raises AttributeError in Python 3, because it tries to use the "split" function from the "string" module, but that's no longer available in Python 3.
We should use the built-in str.split() method of string objects, which works the same in Python 2 and 3.

Traceback (most recent call last):
  File "compatibility_test.py", line 16, in <module>
    expected = string.split(filename, ".compressed")[0]
AttributeError: 'module' object has no attribute 'split'

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/google/brotli/pull/104 **Author:** [@anthrotype](https://github.com/anthrotype) **Created:** 5/8/2015 **Status:** ✅ Merged **Merged:** 5/8/2015 **Merged by:** [@szabadka](https://github.com/szabadka) **Base:** `master` ← **Head:** `py3split` --- ### 📝 Commits (1) - [`e6913b2`](https://github.com/google/brotli/commit/e6913b2e78be95472e54089915057f917231cee7) [python] use built-in split instead of 'string' module for py23 ### 📊 Changes **1 file changed** (+1 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `python/tests/compatibility_test.py` (+1 -2) </details> ### 📄 Description the compatibility_test.py raises AttributeError in Python 3, because it tries to use the "split" function from the "string" module, but that's no longer available in Python 3. We should use the built-in str.split() method of string objects, which works the same in Python 2 and 3. ``` python Traceback (most recent call last): File "compatibility_test.py", line 16, in <module> expected = string.split(filename, ".compressed")[0] AttributeError: 'module' object has no attribute 'split' ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 20:50:28 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#710