Project

General

Profile

Actions

Bug #15322

closed

python3.11 removed codeset from gettext.install()

Added by Andy Fiddaman 5 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:
External Bug:

Description

The codeset parameter of gettext.install() was deprecated in Python 3.8 and finally removed in version 3.11.
This parameter is still used in usr/src/tools/scripts/validate_pkg.py and so it does not run with python 3.11

It's possible to build gate with python 3.11 after #15208 but doing a build using version 3.11 as the primary python version fails at the packaging phase with:

.../opt/onbld/bin/validate_pkg",
line 894, in <module>
    gettext.install("pkg", "/usr/share/locale",
TypeError: install() got an unexpected keyword argument 'codeset'
dmake: Warning: Target `pmodes' not remade because of errors

Related issues

Related to illumos gate - Feature #15208: Allow building with python 3.11ClosedAndy Fiddaman

Actions
Actions #1

Updated by Andy Fiddaman 5 months ago

Actions #2

Updated by Andy Fiddaman 5 months ago

  • Description updated (diff)
Actions #3

Updated by Andy Fiddaman 5 months ago

From the python 3.8 "What's new" document:

The following functions and methods are deprecated in the gettext module: lgettext(), ldgettext(), lngettext() and ldngettext(). They return encoded bytes, and it’s possible that you will get unexpected Unicode-related exceptions if there are encoding problems with the translated strings. It’s much better to use alternatives which return Unicode strings in Python 3. These functions have been broken for a long time.

Function bind_textdomain_codeset(), methods output_charset() and set_output_charset(), and the codeset parameter of functions translation() and install() are also deprecated, since they are only used for the l*gettext() functions.

It appears it was always a nop to pass codeset to gettext.install() and so we should be able to just safely remove this and have the resulting program work on all python versions, including 3.11

Actions #4

Updated by Electric Monk 5 months ago

  • Gerrit CR set to 2600
Actions #5

Updated by Andy Fiddaman 5 months ago

I've done two illumos-gate builds with the patch in the associated gerrit review:

export BUILDPY2='#'
export BUILDPY3=
export BUILDPY2TOOLS='#'
export BUILDPY3TOOLS=
export PYTHON3_VERSION=3.10
export PYTHON3_PKGVERS=-310
export PYTHON3_SUFFIX=
export TOOLS_PYTHON=/usr/bin/python$PYTHON3_VERSION

and

export BUILDPY2='#'
export BUILDPY3=
export BUILDPY2TOOLS='#'
export BUILDPY3TOOLS=
export PYTHON3_VERSION=3.11
export PYTHON3_PKGVERS=-311
export PYTHON3_SUFFIX=
export TOOLS_PYTHON=/usr/bin/python$PYTHON3_VERSION

Both were successful.

Actions #6

Updated by Electric Monk 5 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit cce0d68b020e5b887083e543f5638759fa3dca86

commit  cce0d68b020e5b887083e543f5638759fa3dca86
Author: Andy Fiddaman <illumos@fiddaman.net>
Date:   2023-01-16T20:01:03.000Z

    15322 python3.11 removed codeset from gettext.install()
    Reviewed by: Yuri Pankov <yuri@aetern.org>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Approved by: Dan McDonald <danmcd@mnx.io>

Actions

Also available in: Atom PDF