DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] doc: fix build with python 3.8
@ 2019-12-09 21:00 Thomas Monjalon
  2019-12-10 12:00 ` Bruce Richardson
  2019-12-11 11:01 ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
  0 siblings, 2 replies; 8+ messages in thread
From: Thomas Monjalon @ 2019-12-09 21:00 UTC (permalink / raw)
  To: John McNamara, Marko Kovacevic; +Cc: robin.jarry, dev

After upgrading to python-3.8.0, a syntax mismatch is revealed:

doc/guides/conf.py:240: SyntaxWarning: "is not" with a literal.
    Did you mean "!="?
    if value is not '':

Replacing "is not" with "!=" seems the right thing to do.

A patch may also be needed in the RTD theme package:
https://github.com/readthedocs/sphinx_rtd_theme/commit/a49a812c.diff
(not included in release 0.4.3)

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 doc/guides/conf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/guides/conf.py b/doc/guides/conf.py
index e2b52e2df9..4575253c7b 100644
--- a/doc/guides/conf.py
+++ b/doc/guides/conf.py
@@ -237,7 +237,7 @@ def generate_overview_table(output_filename, table_id, section, table_name, titl
                                                                 ini_filename))
                 continue
 
-            if value is not '':
+            if value != '':
                 # Get the first letter only.
                 ini_data[ini_filename][name] = value[0]
 
-- 
2.24.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] doc: fix build with python 3.8
  2019-12-09 21:00 [dpdk-dev] [PATCH] doc: fix build with python 3.8 Thomas Monjalon
@ 2019-12-10 12:00 ` Bruce Richardson
  2019-12-10 12:27   ` Thomas Monjalon
  2019-12-11 11:01 ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
  1 sibling, 1 reply; 8+ messages in thread
From: Bruce Richardson @ 2019-12-10 12:00 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: John McNamara, Marko Kovacevic, robin.jarry, dev

On Mon, Dec 09, 2019 at 10:00:00PM +0100, Thomas Monjalon wrote:
> After upgrading to python-3.8.0, a syntax mismatch is revealed:
> 
> doc/guides/conf.py:240: SyntaxWarning: "is not" with a literal.
>     Did you mean "!="?
>     if value is not '':
> 
> Replacing "is not" with "!=" seems the right thing to do.
> 

Since this is basically just checking for an empty string is 
"len(value) > 0" not more logical than either comparison against ''?

/Bruce

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] doc: fix build with python 3.8
  2019-12-10 12:00 ` Bruce Richardson
@ 2019-12-10 12:27   ` Thomas Monjalon
  2019-12-10 13:33     ` Robin Jarry
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Monjalon @ 2019-12-10 12:27 UTC (permalink / raw)
  To: Bruce Richardson, robin.jarry; +Cc: John McNamara, Marko Kovacevic, dev

10/12/2019 13:00, Bruce Richardson:
> On Mon, Dec 09, 2019 at 10:00:00PM +0100, Thomas Monjalon wrote:
> > After upgrading to python-3.8.0, a syntax mismatch is revealed:
> > 
> > doc/guides/conf.py:240: SyntaxWarning: "is not" with a literal.
> >     Did you mean "!="?
> >     if value is not '':
> > 
> > Replacing "is not" with "!=" seems the right thing to do.
> > 
> 
> Since this is basically just checking for an empty string is 
> "len(value) > 0" not more logical than either comparison against ''?

Probably yes.
I don't know what is the best practice in Python. Robin, any clue?



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] doc: fix build with python 3.8
  2019-12-10 12:27   ` Thomas Monjalon
@ 2019-12-10 13:33     ` Robin Jarry
  2019-12-11 10:58       ` Thomas Monjalon
  0 siblings, 1 reply; 8+ messages in thread
From: Robin Jarry @ 2019-12-10 13:33 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: Bruce Richardson, John McNamara, Marko Kovacevic, dev

2019-12-10, Thomas Monjalon:
> 10/12/2019 13:00, Bruce Richardson:
> > On Mon, Dec 09, 2019 at 10:00:00PM +0100, Thomas Monjalon wrote:
> > > After upgrading to python-3.8.0, a syntax mismatch is revealed:
> > > 
> > > doc/guides/conf.py:240: SyntaxWarning: "is not" with a literal.
> > >     Did you mean "!="?
> > >     if value is not '':
> > > 
> > > Replacing "is not" with "!=" seems the right thing to do.
> > > 
> > 
> > Since this is basically just checking for an empty string is 
> > "len(value) > 0" not more logical than either comparison against ''?
> 
> Probably yes.
> I don't know what is the best practice in Python. Robin, any clue?

In most cases, it is shorter and cleaner to simply do:

  if value:

which behind the scenes calls value.__bool__() (or value.__len__()).

https://docs.python.org/3/reference/datamodel.html#object.__bool__

-- 
Robin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] doc: fix build with python 3.8
  2019-12-10 13:33     ` Robin Jarry
@ 2019-12-11 10:58       ` Thomas Monjalon
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Monjalon @ 2019-12-11 10:58 UTC (permalink / raw)
  To: Robin Jarry; +Cc: dev, Bruce Richardson, John McNamara, Marko Kovacevic

10/12/2019 14:33, Robin Jarry:
> 2019-12-10, Thomas Monjalon:
> > 10/12/2019 13:00, Bruce Richardson:
> > > On Mon, Dec 09, 2019 at 10:00:00PM +0100, Thomas Monjalon wrote:
> > > > After upgrading to python-3.8.0, a syntax mismatch is revealed:
> > > > 
> > > > doc/guides/conf.py:240: SyntaxWarning: "is not" with a literal.
> > > >     Did you mean "!="?
> > > >     if value is not '':
> > > > 
> > > > Replacing "is not" with "!=" seems the right thing to do.
> > > > 
> > > 
> > > Since this is basically just checking for an empty string is 
> > > "len(value) > 0" not more logical than either comparison against ''?
> > 
> > Probably yes.
> > I don't know what is the best practice in Python. Robin, any clue?
> 
> In most cases, it is shorter and cleaner to simply do:
> 
>   if value:
> 
> which behind the scenes calls value.__bool__() (or value.__len__()).
> 
> https://docs.python.org/3/reference/datamodel.html#object.__bool__

I guess it works also with python 2?

I am sending a v2 with this syntax, thanks.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH v2] doc: fix build with python 3.8
  2019-12-09 21:00 [dpdk-dev] [PATCH] doc: fix build with python 3.8 Thomas Monjalon
  2019-12-10 12:00 ` Bruce Richardson
@ 2019-12-11 11:01 ` Thomas Monjalon
  2019-12-11 11:15   ` Bruce Richardson
  1 sibling, 1 reply; 8+ messages in thread
From: Thomas Monjalon @ 2019-12-11 11:01 UTC (permalink / raw)
  To: John McNamara, Marko Kovacevic; +Cc: Robin Jarry, Bruce Richardson, dev, stable

After upgrading to python-3.8.0, a syntax mismatch is revealed:

doc/guides/conf.py:240: SyntaxWarning: "is not" with a literal.
    Did you mean "!="?
    if value is not '':

Removing "is not ''" seems the right thing to do.

A patch may also be needed in the RTD theme package:
https://github.com/readthedocs/sphinx_rtd_theme/commit/a49a812c.diff
(not included in release 0.4.3)

Fixes: 9db3f52126fb ("doc: generate NIC overview table from ini files")
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
v1: if value != ''
v2: if value
---
 doc/guides/conf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/guides/conf.py b/doc/guides/conf.py
index e2b52e2df9..0892c06dec 100644
--- a/doc/guides/conf.py
+++ b/doc/guides/conf.py
@@ -237,7 +237,7 @@ def generate_overview_table(output_filename, table_id, section, table_name, titl
                                                                 ini_filename))
                 continue
 
-            if value is not '':
+            if value:
                 # Get the first letter only.
                 ini_data[ini_filename][name] = value[0]
 
-- 
2.24.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH v2] doc: fix build with python 3.8
  2019-12-11 11:01 ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
@ 2019-12-11 11:15   ` Bruce Richardson
  2019-12-12 22:27     ` Thomas Monjalon
  0 siblings, 1 reply; 8+ messages in thread
From: Bruce Richardson @ 2019-12-11 11:15 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: John McNamara, Marko Kovacevic, Robin Jarry, dev, stable

On Wed, Dec 11, 2019 at 12:01:40PM +0100, Thomas Monjalon wrote:
> After upgrading to python-3.8.0, a syntax mismatch is revealed:
> 
> doc/guides/conf.py:240: SyntaxWarning: "is not" with a literal.
>     Did you mean "!="?
>     if value is not '':
> 
> Removing "is not ''" seems the right thing to do.
> 
> A patch may also be needed in the RTD theme package:
> https://github.com/readthedocs/sphinx_rtd_theme/commit/a49a812c.diff
> (not included in release 0.4.3)
> 
> Fixes: 9db3f52126fb ("doc: generate NIC overview table from ini files")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH v2] doc: fix build with python 3.8
  2019-12-11 11:15   ` Bruce Richardson
@ 2019-12-12 22:27     ` Thomas Monjalon
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Monjalon @ 2019-12-12 22:27 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson, John McNamara, Marko Kovacevic, Robin Jarry, stable

11/12/2019 12:15, Bruce Richardson:
> On Wed, Dec 11, 2019 at 12:01:40PM +0100, Thomas Monjalon wrote:
> > After upgrading to python-3.8.0, a syntax mismatch is revealed:
> > 
> > doc/guides/conf.py:240: SyntaxWarning: "is not" with a literal.
> >     Did you mean "!="?
> >     if value is not '':
> > 
> > Removing "is not ''" seems the right thing to do.
> > 
> > A patch may also be needed in the RTD theme package:
> > https://github.com/readthedocs/sphinx_rtd_theme/commit/a49a812c.diff
> > (not included in release 0.4.3)
> > 
> > Fixes: 9db3f52126fb ("doc: generate NIC overview table from ini files")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> 
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Applied




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-12-12 22:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-09 21:00 [dpdk-dev] [PATCH] doc: fix build with python 3.8 Thomas Monjalon
2019-12-10 12:00 ` Bruce Richardson
2019-12-10 12:27   ` Thomas Monjalon
2019-12-10 13:33     ` Robin Jarry
2019-12-11 10:58       ` Thomas Monjalon
2019-12-11 11:01 ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
2019-12-11 11:15   ` Bruce Richardson
2019-12-12 22:27     ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).