/usr/lib/python3/dist-packages/genshi/filters/i18n.py:352: SyntaxWarning: "is not" with a literal. Did you mean "!="?

Bug #1931179 reported by Seth Arnold
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
genshi (Ubuntu)
Fix Released
Low
Unassigned
Focal
Fix Released
Low
Michał Małoszewski

Bug Description

[Impact]

The deprecation message shown in below example by the bug reporter isn't helpful to anyone since the user isn’t in a position to update the version of the library being used. It may discourage the user from working with that package. We deprecate lots of things in between releases anyway, so the accidental early warning for just one random item isn’t particularly useful. And developers might be misled into thinking that these deprecations apply to their code and not to the distro-shipped libraries. Finally, it’s just a bad look. Anyway it is worth the candle to fix it, because it should be straightforward and low risk. There is only need to replace the literal “is not” with “!=”. It looks non-professional.

Backport upstream fix to Focal

[Test Plan]

** Reproduction **

Message:

Unpacking python3-genshi (0.7.3-0ubuntu3) ...
Setting up python3-genshi (0.7.3-0ubuntu3) ...
/usr/lib/python3/dist-packages/genshi/filters/i18n.py:352: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  assert numeral is not '', "at least pass the numeral param"

Make a container for testing:

First option:
$ lxc launch images:ubuntu/jammy jammy-test
$ lxc shell jammy-test

Then type in:
$ apt install python3-genshi

You shouldn’t notice neither warning nor error message.

Second one attempt:
$ lxc launch images:ubuntu/foca focal-test
$ lxc shell focal-test

Then type in:
$ apt install python3-genshi

Now you will notice the warning message unless fixed.

** Verification **

Follow the reproduction steps above to ensure that the warning messages no longer appear.

[Where problems could occur]

Any code change might change the behavior of the package in a specific situation and cause other errors - but that particular change is small and looks safe in that regard.

It is only an Assert and functionally equivalent, so we expect no change in behavior. The new syntax is supported way back in time and there should be no python version out there not able to work with the new code.

The old issue was only a warning, so fixing it does not change functional behavior (e.g. return codes or results) except getting rid of the warning message

--- original report ---

$ sudo apt install python3-genshi
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  doc-base python-genshi-doc
The following NEW packages will be installed:
  python3-genshi
0 upgraded, 1 newly installed, 0 to remove and 44 not upgraded.
Need to get 121 kB of archives.
After this operation, 914 kB of additional disk space will be used.
Get:1 http://192.168.0.27/ubuntu focal/main amd64 python3-genshi all 0.7.3-0ubuntu3 [121 kB]
Fetched 121 kB in 0s (3,179 kB/s)
Selecting previously unselected package python3-genshi.
(Reading database ... 229776 files and directories currently installed.)
Preparing to unpack .../python3-genshi_0.7.3-0ubuntu3_all.deb ...
Unpacking python3-genshi (0.7.3-0ubuntu3) ...
Setting up python3-genshi (0.7.3-0ubuntu3) ...
/usr/lib/python3/dist-packages/genshi/filters/i18n.py:352: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  assert numeral is not '', "at least pass the numeral param"

Thanks

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: python3-genshi 0.7.3-0ubuntu3
ProcVersionSignature: Ubuntu 5.4.0-71.79-generic 5.4.101
Uname: Linux 5.4.0-71-generic x86_64
NonfreeKernelModules: lkp_Ubuntu_5_4_0_71_79_generic_77 lkp_Ubuntu_5_4_0_71_79_generic_76 zfs zunicode zavl icp zcommon znvpair
ApportVersion: 2.20.11-0ubuntu27.18
Architecture: amd64
CasperMD5CheckResult: skip
Date: Tue Jun 8 01:16:44 2021
Dependencies:

PackageArchitecture: all
ProcEnviron:
 TERM=rxvt-unicode-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: genshi
UpgradeStatus: Upgraded to focal on 2020-01-24 (500 days ago)

Related branches

Revision history for this message
Seth Arnold (seth-arnold) wrote :
Changed in genshi (Ubuntu):
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thank you for the bug report. I confirm the warning during the installation of the package on Focal (Impish is not affected). Given that this is a relatively harmless warning, and that using "is not" in this particular case still renders the correct result, I'm setting this bug's priority as Low.

Changed in genshi (Ubuntu Focal):
status: New → Triaged
importance: Undecided → Low
Changed in genshi (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Bryce Harrington (bryce) wrote :

Was fixed in 0.7.3 and in debian with 0.7.4-2. Needs this patch:

https://salsa.debian.org/python-team/packages/genshi/-/blob/debian/0.7.4-2/debian/patches/fix-syntax-warning.patch

But yeah, it looks innocuous.

tags: added: bitesize
Changed in genshi (Ubuntu Focal):
assignee: nobody → Michał Małoszewski (michal-maloszewski99)
Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote :

The upstream fix actually landed in 0.7.5, and I verified that Focal 0.7.3-0ubuntu3 is affected by this issue. https://github.com/edgewall/genshi/commit/b41e4d893f4406ebb22e4b0a9c2f98cc0964cfad
Continue with cherry picking commit.

Changed in genshi (Ubuntu Focal):
status: Triaged → In Progress
description: updated
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Thanks for the work on the MP, this is ready for sponsoring now.
A bit low severity, but totally makes sense to suggest - up to the SRU Team to decide.

Uploaded to Focal-unapproved

Revision history for this message
Robie Basak (racb) wrote :

This is a SyntaxWarning rather than a DeprecationWarning. I discussed the latter with the SRU team on the 14th, and we concluded that it is an acceptable class of bug to fix in SRUs. I think this SyntaxWarning falls into the same category, so I'm accepting this into focal-proposed.

Changed in genshi (Ubuntu Focal):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-focal
Revision history for this message
Robie Basak (racb) wrote : Please test proposed package

Hello Seth, or anyone else affected,

Accepted genshi into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/genshi/0.7.3-0ubuntu3.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Revision history for this message
Seth Arnold (seth-arnold) wrote :
Download full text (3.6 KiB)

The version in -proposed installed without the syntax warning:

$ sudo apt install python3-genshi=0.7.3-0ubuntu3.1
[sudo] password for sarnold:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  libfwupdplugin1
Use 'sudo apt autoremove' to remove it.
Suggested packages:
  doc-base python-genshi-doc
The following packages will be upgraded:
  python3-genshi
1 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
Need to get 121 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://192.168.0.27/ubuntu focal-proposed/main amd64 python3-genshi all 0.7.3-0ubuntu3.1 [121 kB]
Fetched 121 kB in 0s (701 kB/s)
(Reading database ... 209443 files and directories currently installed.)
Preparing to unpack .../python3-genshi_0.7.3-0ubuntu3.1_all.deb ...
Unpacking python3-genshi (0.7.3-0ubuntu3.1) over (0.7.3-0ubuntu3) ...
Setting up python3-genshi (0.7.3-0ubuntu3.1) ...

The tests supplied with the package work:

[sarnold:/usr/lib/python3/dist-packages/genshi/tests] $ for f in * ; do python3 $f ; done
........
----------------------------------------------------------------------
Ran 8 tests in 0.006s

OK
................................................/usr/lib/python3/dist-packages/genshi/template/interpolation.py:34: DeprecationWarning: Flags not at the start of the expression '[uU]?[rR]?("""|\\\'\\\'\\' (truncated)
  token_re = re.compile('%s|%s(?s)' % (
....
----------------------------------------------------------------------
Ran 52 tests in 0.022s

OK
...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................<string>:1: SyntaxWarning: "is" with a literal. Did you mean "=="?
<string>:1: SyntaxWarning: "is" with a literal. Did you mean "=="?
.<string>:1: SyntaxWarning: "is not" with a literal. Did you mean "!="?
<string>:1: SyntaxWarning: "is not" with a literal. Did you mean "!="?
...............................................................................................................................................................................................................................................................
----------------------------------------------------------------------
Ran 867 tests in 0.704s

OK
..................................
----------------------------------------------------------------------
Ran 34 tests in 0.014s

OK
....................................................
----------------------------------------------------------------------
Ran 52 tests in 0.019s

OK
............................

Read more...

tags: added: verification-done-focal
removed: verification-needed-focal
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package genshi - 0.7.3-0ubuntu3.1

---------------
genshi (0.7.3-0ubuntu3.1) focal; urgency=medium

  * d/p/genshi-is-not-p.patch: Replace 'is not' with '!=' to fix
    deprecation warning (LP: #1931179)

 -- Michal Maloszewski <email address hidden> Fri, 01 Jul 2022 20:54:58 +0200

Changed in genshi (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Robie Basak (racb) wrote : Update Released

The verification of the Stable Release Update for genshi has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers