[Bug 1877792] Re: jmespath SyntaxWarning: "is" with a literal.

Eric Desrochers 1877792 at bugs.launchpad.net
Tue Oct 5 18:49:31 UTC 2021


** Description changed:

+ [IMPACT]
+ 
+ [TEST CASE]
+ 
+ ** Scenario #1 **
+ This could be reproduced outside python-jmespath as follows (a little script I have written to compare result between py2 and py3 :
+ 
+ # reproducer_test.py
+ ----
+ def reproducer(x,y):
+     if x is 0 or x is 1:
+         return y is True or y is False
+     elif y is 0 or y is 1:
+         return x is True or x is False
+ 
+ print(reproducer(1,0))
+ print(reproducer(0,1))
+ ---
+ 
+ $ python2 reproducer_test.py 
+ False
+ False
+ 
+ $ python3 reproducer_test.py 
+ test.py:2: SyntaxWarning: "is" with a literal. Did you mean "=="?
+   if x is 0 or x is 1:
+ test.py:2: SyntaxWarning: "is" with a literal. Did you mean "=="?
+   if x is 0 or x is 1:
+ test.py:4: SyntaxWarning: "is" with a literal. Did you mean "=="?
+   elif y is 0 or y is 1:
+ test.py:4: SyntaxWarning: "is" with a literal. Did you mean "=="?
+   elif y is 0 or y is 1:
+ False
+ False
+ 
+ 
+ With the fix in a small scale (Again, using my reproducer_test.py):
+ 
+ def reproducer(x,y):
+ #    if x is 0 or x is 1:
+      if type(x) is int and (x == 0 or x == 1):
+         return y is True or y is False
+ #    elif y is 0 or y is 1:
+      elif type(y) is int and (y == 0 or y == 1):
+         return x is True or x is False
+ 
+ print(reproducer(1,0))
+ print(reproducer(0,1))
+ 
+ # python2 reproducer_test.py
+ False
+ False
+ 
+ $ python3 reproducer_test.py 
+ False
+ False
+ 
+ [WHERE PROBLEM COULD OCCURS]
+ 
+ [OTHER INFORMATIONS]
+ 
  As reported upstream
  
  https://github.com/jmespath/jmespath.py/issues/201
  Problems installing jmespath in Ubuntu 20.04 LTS
  
  Setting up python3-jmespath (0.9.4-2) ...
  /usr/lib/python3/dist-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="?
  
  Fixed upstream in
  https://github.com/jmespath/jmespath.py/commit/56263b84cdb0feb7c8d54e426ec472f4dd0de44f
  
  Impact: this causes applications like Ansible that have dependencies on
  python-jmespath to send out warnings. Caused by language changes in
  Python 3.8.
  
  System is Ubuntu 20.04 LTS on a Pi 4.
  
  emv at pinnatus:~$ apt-cache policy python3-jmespath
  python3-jmespath:
-   Installed: 0.9.4-2
-   Candidate: 0.9.4-2
-   Version table:
-  *** 0.9.4-2 500
-         500 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 Packages
-         100 /var/lib/dpkg/status
+   Installed: 0.9.4-2
+   Candidate: 0.9.4-2
+   Version table:
+  *** 0.9.4-2 500
+         500 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 Packages
+         100 /var/lib/dpkg/status

** Description changed:

  [IMPACT]
  
  [TEST CASE]
  
  ** Scenario #1 **
  This could be reproduced outside python-jmespath as follows (a little script I have written to compare result between py2 and py3 :
  
  # reproducer_test.py
  ----
  def reproducer(x,y):
-     if x is 0 or x is 1:
-         return y is True or y is False
-     elif y is 0 or y is 1:
-         return x is True or x is False
+     if x is 0 or x is 1:
+         return y is True or y is False
+     elif y is 0 or y is 1:
+         return x is True or x is False
  
  print(reproducer(1,0))
  print(reproducer(0,1))
  ---
  
- $ python2 reproducer_test.py 
+ $ python2 reproducer_test.py
  False
  False
  
- $ python3 reproducer_test.py 
+ $ python3 reproducer_test.py
  test.py:2: SyntaxWarning: "is" with a literal. Did you mean "=="?
-   if x is 0 or x is 1:
+   if x is 0 or x is 1:
  test.py:2: SyntaxWarning: "is" with a literal. Did you mean "=="?
-   if x is 0 or x is 1:
+   if x is 0 or x is 1:
  test.py:4: SyntaxWarning: "is" with a literal. Did you mean "=="?
-   elif y is 0 or y is 1:
+   elif y is 0 or y is 1:
  test.py:4: SyntaxWarning: "is" with a literal. Did you mean "=="?
-   elif y is 0 or y is 1:
+   elif y is 0 or y is 1:
  False
  False
  
- 
  With the fix in a small scale (Again, using my reproducer_test.py):
  
+ # reproducer_test.py
+ ----
  def reproducer(x,y):
  #    if x is 0 or x is 1:
-      if type(x) is int and (x == 0 or x == 1):
-         return y is True or y is False
+      if type(x) is int and (x == 0 or x == 1):
+         return y is True or y is False
  #    elif y is 0 or y is 1:
-      elif type(y) is int and (y == 0 or y == 1):
-         return x is True or x is False
+      elif type(y) is int and (y == 0 or y == 1):
+         return x is True or x is False
  
  print(reproducer(1,0))
  print(reproducer(0,1))
+ ---
  
  # python2 reproducer_test.py
  False
  False
  
- $ python3 reproducer_test.py 
+ $ python3 reproducer_test.py
  False
  False
  
  [WHERE PROBLEM COULD OCCURS]
  
  [OTHER INFORMATIONS]
  
  As reported upstream
  
  https://github.com/jmespath/jmespath.py/issues/201
  Problems installing jmespath in Ubuntu 20.04 LTS
  
  Setting up python3-jmespath (0.9.4-2) ...
  /usr/lib/python3/dist-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="?
  
  Fixed upstream in
  https://github.com/jmespath/jmespath.py/commit/56263b84cdb0feb7c8d54e426ec472f4dd0de44f
  
  Impact: this causes applications like Ansible that have dependencies on
  python-jmespath to send out warnings. Caused by language changes in
  Python 3.8.
  
  System is Ubuntu 20.04 LTS on a Pi 4.
  
  emv at pinnatus:~$ apt-cache policy python3-jmespath
  python3-jmespath:
    Installed: 0.9.4-2
    Candidate: 0.9.4-2
    Version table:
   *** 0.9.4-2 500
          500 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 Packages
          100 /var/lib/dpkg/status

** Description changed:

  [IMPACT]
  
  [TEST CASE]
  
  ** Scenario #1 **
  This could be reproduced outside python-jmespath as follows (a little script I have written to compare result between py2 and py3 :
  
  # reproducer_test.py
  ----
  def reproducer(x,y):
      if x is 0 or x is 1:
          return y is True or y is False
      elif y is 0 or y is 1:
          return x is True or x is False
  
  print(reproducer(1,0))
  print(reproducer(0,1))
  ---
  
  $ python2 reproducer_test.py
  False
  False
  
  $ python3 reproducer_test.py
  test.py:2: SyntaxWarning: "is" with a literal. Did you mean "=="?
    if x is 0 or x is 1:
  test.py:2: SyntaxWarning: "is" with a literal. Did you mean "=="?
    if x is 0 or x is 1:
  test.py:4: SyntaxWarning: "is" with a literal. Did you mean "=="?
    elif y is 0 or y is 1:
  test.py:4: SyntaxWarning: "is" with a literal. Did you mean "=="?
    elif y is 0 or y is 1:
  False
  False
  
  With the fix in a small scale (Again, using my reproducer_test.py):
  
  # reproducer_test.py
  ----
  def reproducer(x,y):
  #    if x is 0 or x is 1:
       if type(x) is int and (x == 0 or x == 1):
          return y is True or y is False
  #    elif y is 0 or y is 1:
       elif type(y) is int and (y == 0 or y == 1):
          return x is True or x is False
  
  print(reproducer(1,0))
  print(reproducer(0,1))
  ---
  
  # python2 reproducer_test.py
  False
  False
  
  $ python3 reproducer_test.py
  False
  False
  
+ The above proves that it maintains compatibility in py2 while fixing the
+ "SyntaxWarning "in py3.
+ 
  [WHERE PROBLEM COULD OCCURS]
  
  [OTHER INFORMATIONS]
  
  As reported upstream
  
  https://github.com/jmespath/jmespath.py/issues/201
  Problems installing jmespath in Ubuntu 20.04 LTS
  
  Setting up python3-jmespath (0.9.4-2) ...
  /usr/lib/python3/dist-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="?
  
  Fixed upstream in
  https://github.com/jmespath/jmespath.py/commit/56263b84cdb0feb7c8d54e426ec472f4dd0de44f
  
  Impact: this causes applications like Ansible that have dependencies on
  python-jmespath to send out warnings. Caused by language changes in
  Python 3.8.
  
  System is Ubuntu 20.04 LTS on a Pi 4.
  
  emv at pinnatus:~$ apt-cache policy python3-jmespath
  python3-jmespath:
    Installed: 0.9.4-2
    Candidate: 0.9.4-2
    Version table:
   *** 0.9.4-2 500
          500 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 Packages
          100 /var/lib/dpkg/status

** Tags added: seg sts

** Changed in: python-jmespath (Ubuntu Focal)
       Status: New => Confirmed

** Changed in: python-jmespath (Ubuntu Bionic)
       Status: New => Confirmed

** Description changed:

  [IMPACT]
  
  [TEST CASE]
  
  ** Scenario #1 **
  This could be reproduced outside python-jmespath as follows (a little script I have written to compare result between py2 and py3 :
  
  # reproducer_test.py
  ----
  def reproducer(x,y):
      if x is 0 or x is 1:
          return y is True or y is False
      elif y is 0 or y is 1:
          return x is True or x is False
  
  print(reproducer(1,0))
  print(reproducer(0,1))
  ---
  
  $ python2 reproducer_test.py
  False
  False
  
  $ python3 reproducer_test.py
  test.py:2: SyntaxWarning: "is" with a literal. Did you mean "=="?
    if x is 0 or x is 1:
  test.py:2: SyntaxWarning: "is" with a literal. Did you mean "=="?
    if x is 0 or x is 1:
  test.py:4: SyntaxWarning: "is" with a literal. Did you mean "=="?
    elif y is 0 or y is 1:
  test.py:4: SyntaxWarning: "is" with a literal. Did you mean "=="?
    elif y is 0 or y is 1:
  False
  False
  
  With the fix in a small scale (Again, using my reproducer_test.py):
  
  # reproducer_test.py
  ----
  def reproducer(x,y):
  #    if x is 0 or x is 1:
       if type(x) is int and (x == 0 or x == 1):
          return y is True or y is False
  #    elif y is 0 or y is 1:
       elif type(y) is int and (y == 0 or y == 1):
          return x is True or x is False
  
  print(reproducer(1,0))
  print(reproducer(0,1))
  ---
  
  # python2 reproducer_test.py
  False
  False
  
  $ python3 reproducer_test.py
  False
  False
  
  The above proves that it maintains compatibility in py2 while fixing the
  "SyntaxWarning "in py3.
  
  [WHERE PROBLEM COULD OCCURS]
  
  [OTHER INFORMATIONS]
  
+ Upstream issue:
+ https://github.com/jmespath/jmespath.py/issues/187
+ 
+ Upstream commit:
+ https://github.com/jmespath/jmespath.py/commit/56263b84cdb0feb7c8d54e426ec472f4dd0de44f
+ 
+ [ORIGINAL DESCRIPTIONS]
  As reported upstream
  
  https://github.com/jmespath/jmespath.py/issues/201
  Problems installing jmespath in Ubuntu 20.04 LTS
  
  Setting up python3-jmespath (0.9.4-2) ...
  /usr/lib/python3/dist-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="?
  
  Fixed upstream in
  https://github.com/jmespath/jmespath.py/commit/56263b84cdb0feb7c8d54e426ec472f4dd0de44f
  
  Impact: this causes applications like Ansible that have dependencies on
  python-jmespath to send out warnings. Caused by language changes in
  Python 3.8.
  
  System is Ubuntu 20.04 LTS on a Pi 4.
  
  emv at pinnatus:~$ apt-cache policy python3-jmespath
  python3-jmespath:
    Installed: 0.9.4-2
    Candidate: 0.9.4-2
    Version table:
   *** 0.9.4-2 500
          500 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 Packages
          100 /var/lib/dpkg/status

** Description changed:

  [IMPACT]
+ 
+ Allow broader Ops/Eng team to consume Ansible from our packages instead
+ of the upstream PyPi repositories in order to fix this warning.
  
  [TEST CASE]
  
  ** Scenario #1 **
  This could be reproduced outside python-jmespath as follows (a little script I have written to compare result between py2 and py3 :
  
  # reproducer_test.py
  ----
  def reproducer(x,y):
      if x is 0 or x is 1:
          return y is True or y is False
      elif y is 0 or y is 1:
          return x is True or x is False
  
  print(reproducer(1,0))
  print(reproducer(0,1))
  ---
  
  $ python2 reproducer_test.py
  False
  False
  
  $ python3 reproducer_test.py
  test.py:2: SyntaxWarning: "is" with a literal. Did you mean "=="?
    if x is 0 or x is 1:
  test.py:2: SyntaxWarning: "is" with a literal. Did you mean "=="?
    if x is 0 or x is 1:
  test.py:4: SyntaxWarning: "is" with a literal. Did you mean "=="?
    elif y is 0 or y is 1:
  test.py:4: SyntaxWarning: "is" with a literal. Did you mean "=="?
    elif y is 0 or y is 1:
  False
  False
  
  With the fix in a small scale (Again, using my reproducer_test.py):
  
  # reproducer_test.py
  ----
  def reproducer(x,y):
  #    if x is 0 or x is 1:
       if type(x) is int and (x == 0 or x == 1):
          return y is True or y is False
  #    elif y is 0 or y is 1:
       elif type(y) is int and (y == 0 or y == 1):
          return x is True or x is False
  
  print(reproducer(1,0))
  print(reproducer(0,1))
  ---
  
  # python2 reproducer_test.py
  False
  False
  
  $ python3 reproducer_test.py
  False
  False
  
  The above proves that it maintains compatibility in py2 while fixing the
  "SyntaxWarning "in py3.
  
  [WHERE PROBLEM COULD OCCURS]
  
  [OTHER INFORMATIONS]
  
  Upstream issue:
  https://github.com/jmespath/jmespath.py/issues/187
  
  Upstream commit:
  https://github.com/jmespath/jmespath.py/commit/56263b84cdb0feb7c8d54e426ec472f4dd0de44f
  
  [ORIGINAL DESCRIPTIONS]
  As reported upstream
  
  https://github.com/jmespath/jmespath.py/issues/201
  Problems installing jmespath in Ubuntu 20.04 LTS
  
  Setting up python3-jmespath (0.9.4-2) ...
  /usr/lib/python3/dist-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="?
  
  Fixed upstream in
  https://github.com/jmespath/jmespath.py/commit/56263b84cdb0feb7c8d54e426ec472f4dd0de44f
  
  Impact: this causes applications like Ansible that have dependencies on
  python-jmespath to send out warnings. Caused by language changes in
  Python 3.8.
  
  System is Ubuntu 20.04 LTS on a Pi 4.
  
  emv at pinnatus:~$ apt-cache policy python3-jmespath
  python3-jmespath:
    Installed: 0.9.4-2
    Candidate: 0.9.4-2
    Version table:
   *** 0.9.4-2 500
          500 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 Packages
          100 /var/lib/dpkg/status

** Description changed:

  [IMPACT]
  
  Allow broader Ops/Eng team to consume Ansible from our packages instead
  of the upstream PyPi repositories in order to fix this warning.
+ 
+ And sanitize package installation:
+ 
+ Setting up python3-jmespath (0.9.4-2) ...
+ /usr/lib/python3/dist-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="?
  
  [TEST CASE]
  
  ** Scenario #1 **
  This could be reproduced outside python-jmespath as follows (a little script I have written to compare result between py2 and py3 :
  
  # reproducer_test.py
  ----
  def reproducer(x,y):
      if x is 0 or x is 1:
          return y is True or y is False
      elif y is 0 or y is 1:
          return x is True or x is False
  
  print(reproducer(1,0))
  print(reproducer(0,1))
  ---
  
  $ python2 reproducer_test.py
  False
  False
  
  $ python3 reproducer_test.py
  test.py:2: SyntaxWarning: "is" with a literal. Did you mean "=="?
    if x is 0 or x is 1:
  test.py:2: SyntaxWarning: "is" with a literal. Did you mean "=="?
    if x is 0 or x is 1:
  test.py:4: SyntaxWarning: "is" with a literal. Did you mean "=="?
    elif y is 0 or y is 1:
  test.py:4: SyntaxWarning: "is" with a literal. Did you mean "=="?
    elif y is 0 or y is 1:
  False
  False
  
  With the fix in a small scale (Again, using my reproducer_test.py):
  
  # reproducer_test.py
  ----
  def reproducer(x,y):
  #    if x is 0 or x is 1:
       if type(x) is int and (x == 0 or x == 1):
          return y is True or y is False
  #    elif y is 0 or y is 1:
       elif type(y) is int and (y == 0 or y == 1):
          return x is True or x is False
  
  print(reproducer(1,0))
  print(reproducer(0,1))
  ---
  
  # python2 reproducer_test.py
  False
  False
  
  $ python3 reproducer_test.py
  False
  False
  
  The above proves that it maintains compatibility in py2 while fixing the
  "SyntaxWarning "in py3.
  
  [WHERE PROBLEM COULD OCCURS]
  
  [OTHER INFORMATIONS]
  
  Upstream issue:
  https://github.com/jmespath/jmespath.py/issues/187
  
  Upstream commit:
  https://github.com/jmespath/jmespath.py/commit/56263b84cdb0feb7c8d54e426ec472f4dd0de44f
  
  [ORIGINAL DESCRIPTIONS]
  As reported upstream
  
  https://github.com/jmespath/jmespath.py/issues/201
  Problems installing jmespath in Ubuntu 20.04 LTS
  
  Setting up python3-jmespath (0.9.4-2) ...
  /usr/lib/python3/dist-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="?
  
  Fixed upstream in
  https://github.com/jmespath/jmespath.py/commit/56263b84cdb0feb7c8d54e426ec472f4dd0de44f
  
  Impact: this causes applications like Ansible that have dependencies on
  python-jmespath to send out warnings. Caused by language changes in
  Python 3.8.
  
  System is Ubuntu 20.04 LTS on a Pi 4.
  
  emv at pinnatus:~$ apt-cache policy python3-jmespath
  python3-jmespath:
    Installed: 0.9.4-2
    Candidate: 0.9.4-2
    Version table:
   *** 0.9.4-2 500
          500 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 Packages
          100 /var/lib/dpkg/status

** Description changed:

  [IMPACT]
  
- Allow broader Ops/Eng team to consume Ansible from our packages instead
- of the upstream PyPi repositories in order to fix this warning.
+ * Allow broader Ops/Eng team to consume Ansible from our packages
+ instead of the upstream PyPi repositories in order to fix this warning.
  
- And sanitize package installation:
+ * Sanitize package installation:
  
  Setting up python3-jmespath (0.9.4-2) ...
  /usr/lib/python3/dist-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="?
  
  [TEST CASE]
  
  ** Scenario #1 **
  This could be reproduced outside python-jmespath as follows (a little script I have written to compare result between py2 and py3 :
  
  # reproducer_test.py
  ----
  def reproducer(x,y):
      if x is 0 or x is 1:
          return y is True or y is False
      elif y is 0 or y is 1:
          return x is True or x is False
  
  print(reproducer(1,0))
  print(reproducer(0,1))
  ---
  
  $ python2 reproducer_test.py
  False
  False
  
  $ python3 reproducer_test.py
  test.py:2: SyntaxWarning: "is" with a literal. Did you mean "=="?
    if x is 0 or x is 1:
  test.py:2: SyntaxWarning: "is" with a literal. Did you mean "=="?
    if x is 0 or x is 1:
  test.py:4: SyntaxWarning: "is" with a literal. Did you mean "=="?
    elif y is 0 or y is 1:
  test.py:4: SyntaxWarning: "is" with a literal. Did you mean "=="?
    elif y is 0 or y is 1:
  False
  False
  
  With the fix in a small scale (Again, using my reproducer_test.py):
  
  # reproducer_test.py
  ----
  def reproducer(x,y):
  #    if x is 0 or x is 1:
       if type(x) is int and (x == 0 or x == 1):
          return y is True or y is False
  #    elif y is 0 or y is 1:
       elif type(y) is int and (y == 0 or y == 1):
          return x is True or x is False
  
  print(reproducer(1,0))
  print(reproducer(0,1))
  ---
  
  # python2 reproducer_test.py
  False
  False
  
  $ python3 reproducer_test.py
  False
  False
  
  The above proves that it maintains compatibility in py2 while fixing the
  "SyntaxWarning "in py3.
  
  [WHERE PROBLEM COULD OCCURS]
  
  [OTHER INFORMATIONS]
  
  Upstream issue:
  https://github.com/jmespath/jmespath.py/issues/187
  
  Upstream commit:
  https://github.com/jmespath/jmespath.py/commit/56263b84cdb0feb7c8d54e426ec472f4dd0de44f
  
  [ORIGINAL DESCRIPTIONS]
  As reported upstream
  
  https://github.com/jmespath/jmespath.py/issues/201
  Problems installing jmespath in Ubuntu 20.04 LTS
  
  Setting up python3-jmespath (0.9.4-2) ...
  /usr/lib/python3/dist-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="?
  
  Fixed upstream in
  https://github.com/jmespath/jmespath.py/commit/56263b84cdb0feb7c8d54e426ec472f4dd0de44f
  
  Impact: this causes applications like Ansible that have dependencies on
  python-jmespath to send out warnings. Caused by language changes in
  Python 3.8.
  
  System is Ubuntu 20.04 LTS on a Pi 4.
  
  emv at pinnatus:~$ apt-cache policy python3-jmespath
  python3-jmespath:
    Installed: 0.9.4-2
    Candidate: 0.9.4-2
    Version table:
   *** 0.9.4-2 500
          500 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 Packages
          100 /var/lib/dpkg/status

** Changed in: ansible (Ubuntu Bionic)
       Status: New => Won't Fix

** Changed in: ansible (Ubuntu Focal)
       Status: New => Won't Fix

** Changed in: ansible (Ubuntu Hirsute)
       Status: New => Won't Fix

-- 
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to python-jmespath in Ubuntu.
https://bugs.launchpad.net/bugs/1877792

Title:
  jmespath SyntaxWarning: "is" with a literal.

Status in ansible package in Ubuntu:
  Invalid
Status in python-jmespath package in Ubuntu:
  Fix Released
Status in ansible source package in Bionic:
  Won't Fix
Status in python-jmespath source package in Bionic:
  Confirmed
Status in ansible source package in Focal:
  Won't Fix
Status in python-jmespath source package in Focal:
  Confirmed
Status in ansible source package in Hirsute:
  Won't Fix
Status in python-jmespath source package in Hirsute:
  Fix Released
Status in ansible source package in Impish:
  Invalid
Status in python-jmespath source package in Impish:
  Fix Released
Status in python-jmespath package in Debian:
  Fix Released

Bug description:
  [IMPACT]

  * Allow broader Ops/Eng team to consume Ansible from our packages
  instead of the upstream PyPi repositories in order to fix this
  warning.

  * Sanitize package installation:

  Setting up python3-jmespath (0.9.4-2) ...
  /usr/lib/python3/dist-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="?

  [TEST CASE]

  ** Scenario #1 **
  This could be reproduced outside python-jmespath as follows (a little script I have written to compare result between py2 and py3 :

  # reproducer_test.py
  ----
  def reproducer(x,y):
      if x is 0 or x is 1:
          return y is True or y is False
      elif y is 0 or y is 1:
          return x is True or x is False

  print(reproducer(1,0))
  print(reproducer(0,1))
  ---

  $ python2 reproducer_test.py
  False
  False

  $ python3 reproducer_test.py
  test.py:2: SyntaxWarning: "is" with a literal. Did you mean "=="?
    if x is 0 or x is 1:
  test.py:2: SyntaxWarning: "is" with a literal. Did you mean "=="?
    if x is 0 or x is 1:
  test.py:4: SyntaxWarning: "is" with a literal. Did you mean "=="?
    elif y is 0 or y is 1:
  test.py:4: SyntaxWarning: "is" with a literal. Did you mean "=="?
    elif y is 0 or y is 1:
  False
  False

  With the fix in a small scale (Again, using my reproducer_test.py):

  # reproducer_test.py
  ----
  def reproducer(x,y):
  #    if x is 0 or x is 1:
       if type(x) is int and (x == 0 or x == 1):
          return y is True or y is False
  #    elif y is 0 or y is 1:
       elif type(y) is int and (y == 0 or y == 1):
          return x is True or x is False

  print(reproducer(1,0))
  print(reproducer(0,1))
  ---

  # python2 reproducer_test.py
  False
  False

  $ python3 reproducer_test.py
  False
  False

  The above proves that it maintains compatibility in py2 while fixing
  the "SyntaxWarning "in py3.

  [WHERE PROBLEM COULD OCCURS]

  [OTHER INFORMATIONS]

  Upstream issue:
  https://github.com/jmespath/jmespath.py/issues/187

  Upstream commit:
  https://github.com/jmespath/jmespath.py/commit/56263b84cdb0feb7c8d54e426ec472f4dd0de44f

  [ORIGINAL DESCRIPTIONS]
  As reported upstream

  https://github.com/jmespath/jmespath.py/issues/201
  Problems installing jmespath in Ubuntu 20.04 LTS

  Setting up python3-jmespath (0.9.4-2) ...
  /usr/lib/python3/dist-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="?

  Fixed upstream in
  https://github.com/jmespath/jmespath.py/commit/56263b84cdb0feb7c8d54e426ec472f4dd0de44f

  Impact: this causes applications like Ansible that have dependencies
  on python-jmespath to send out warnings. Caused by language changes in
  Python 3.8.

  System is Ubuntu 20.04 LTS on a Pi 4.

  emv at pinnatus:~$ apt-cache policy python3-jmespath
  python3-jmespath:
    Installed: 0.9.4-2
    Candidate: 0.9.4-2
    Version table:
   *** 0.9.4-2 500
          500 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 Packages
          100 /var/lib/dpkg/status

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ansible/+bug/1877792/+subscriptions




More information about the Ubuntu-openstack-bugs mailing list