Bug 1501511 - Python 3.6.3 breaks Pykickstart build due to string handling change
Summary: Python 3.6.3 breaks Pykickstart build due to string handling change
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: python3
Version: rawhide
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Charalampos Stratakis
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-10-12 16:59 UTC by Martin Kolman
Modified: 2018-01-18 13:55 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-01-18 13:55:51 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Python 29755 0 None None None 2017-10-13 11:13:20 UTC

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.


Note You need to log in before you can comment on or make changes to this bug.