Bug 1501511

Summary: Python 3.6.3 breaks Pykickstart build due to string handling change
Product: [Fedora] Fedora Reporter: Martin Kolman <mkolman>
Component: python3Assignee: Charalampos Stratakis <cstratak>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: bkabrda, clumens, cstratak, ishcherb, jkonecny, mcyprian, mhroncok, mkolman, pviktori, rkuska, tomspur, torsava
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-01-18 13:55:51 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:

Description Martin Kolman 2017-10-12 16:59:58 UTC
Description of problem:
Some change in how Python 3.6.3 works with strings breaks a Pykickstart unittest, which results in failed build in Koji.

Version-Release number of selected component (if applicable):
3.6.3


How reproducible:
always

Steps to Reproduce:
1. try to build the Pykickstart package with Python 3.6.3

Actual results:
Build fails due to unit test failure.

Expected results:
Build succeeds.

Additional info:
These are the test failures in question:

======================================================================
ERROR: runTest (tests.commands.reqpart.F23_AutopartReqpart_TestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/python3-pykickstart-2.40-1.fc28/tests/commands/reqpart.py", line 38, in runTest
    reqpart""")
  File "/builddir/build/BUILD/python3-pykickstart-2.40-1.fc28/tests/baseclass.py", line 62, in assert_parse_error
    self.parser.readKickstartFromString(ks_string)
  File "/builddir/build/BUILD/python3-pykickstart-2.40-1.fc28/pykickstart/parser.py", line 774, in readKickstartFromString
    self._stateMachine (i)
  File "/builddir/build/BUILD/python3-pykickstart-2.40-1.fc28/pykickstart/parser.py", line 757, in _stateMachine
    self._tryFunc(lambda: self.handleCommand(lineno, args))
  File "/builddir/build/BUILD/python3-pykickstart-2.40-1.fc28/pykickstart/parser.py", line 669, in _tryFunc
    fn()
  File "/builddir/build/BUILD/python3-pykickstart-2.40-1.fc28/pykickstart/parser.py", line 757, in <lambda>
    self._tryFunc(lambda: self.handleCommand(lineno, args))
  File "/builddir/build/BUILD/python3-pykickstart-2.40-1.fc28/pykickstart/parser.py", line 560, in handleCommand
    retval = self.handler.dispatcher(args, lineno)
  File "/builddir/build/BUILD/python3-pykickstart-2.40-1.fc28/pykickstart/base.py", line 459, in dispatcher
    obj = self.commands[cmd].parse(args[1:])
  File "/builddir/build/BUILD/python3-pykickstart-2.40-1.fc28/pykickstart/commands/reqpart.py", line 62, in parse
    "autopart"
TypeError: %b requires a bytes-like object, or an object that implements __bytes__, not 'str'
======================================================================
ERROR: runTest (tests.commands.snapshot.RHEL7_TestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/python3-pykickstart-2.40-1.fc28/tests/commands/snapshot.py", line 32, in runTest
    exception=KickstartValueError)
  File "/builddir/build/BUILD/python3-pykickstart-2.40-1.fc28/tests/baseclass.py", line 191, in assert_parse_error
    parser.parse(args[1:])
  File "/builddir/build/BUILD/python3-pykickstart-2.40-1.fc28/pykickstart/commands/snapshot.py", line 123, in parse
    msg = (_("Snapshot origin %s must be specified by VG/LV!") % snap_data.origin)
TypeError: %b requires a bytes-like object, or an object that implements __bytes__, not 'str'

Full log file:
https://kojipkgs.fedoraproject.org//work/tasks/2701/22402701/build.log

The same version of Pykickstart builds fine on F27 where there still is Python 3.6.2.

Comment 1 Charalampos Stratakis 2017-10-16 10:18:27 UTC
It seems that this was already fixed upstream:

https://github.com/rhinstaller/pykickstart/commit/453391e046decc3905e76292292c0c3b24ac401d#diff-4be571911612faa1b8c6ab28d45ed2ed

The commit that changed the behaviour in Python 3.6.3 is: https://github.com/python/cpython/commit/a1115e1a0454f0548f96cace6ee97b286dfa1c0d

with that the gettext.ldgettext function that pykickstart uses will always return bytes instead of string now.