HyukjinKwon commented on a change in pull request #25289: [SPARK-27889][INFRA] 
Make development scripts under dev/ support Python 3
URL: https://github.com/apache/spark/pull/25289#discussion_r312085007
 
 

 ##########
 File path: dev/github_jira_sync.py
 ##########
 @@ -122,13 +129,13 @@ def reset_pr_labels(pr_num, jira_components):
     url = '%s/issues/%s/labels' % (GITHUB_API_BASE, pr_num)
     labels = ', '.join(('"%s"' % c) for c in jira_components)
     try:
-        request = urllib2.Request(url, data='{"labels":[%s]}' % labels)
+        request = Request(url, data=('{"labels":[%s]}' % 
labels).encode('utf-8'))
 
 Review comment:
   @WeichenXu123, can use `u'{"labels":[%s]}' % labels).encode('utf-8')` so 
that it's always an unicode in both Python 2 and Python 3, and always executes 
same code path?
   
   Currently,
   - In Python 2, it will be bytes -> unicodes -> bytes (by implicit conversion)
   - in Python 3, unicodes -> bytes.
   
   After using `u`, 
   
   Both will do unicodes -> bytes.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to