Bug 1790706

Summary: python-txws: Fix Python 3.9 compatibility
Product: [Fedora] Fedora Reporter: Charalampos Stratakis <cstratak>
Component: python-txwsAssignee: Fedora Infrastructure SIG <infra-sig>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: infra-sig, kevin, mhroncok, rbean, tir.karthi
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-02-10 21:58:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1785415, 1790701    

Description Charalampos Stratakis 2020-01-14 00:24:16 UTC
python-txws code is not compatible with Python 3.9

More specifically the tostring() method was removed (which was an alias to the tobytes()).

While the package compiles successfully, code that uses it fail with a traceback.

A minimal fix is required to fix that:

diff --git a/txws.py b/txws.py
index 7de92a4..b81a274 100644
--- a/txws.py
+++ b/txws.py
@@ -214,7 +214,7 @@ def mask(buf, key):
     buf = array.array("B", buf)
     for i in range(len(buf)):
         buf[i] ^= key[i % 4]
-    return buf.tostring()
+    return buf.tobytes()
 
 def make_hybi07_frame(buf, opcode=0x1):
     """