Skip to content

Commit 40020fe

Browse files
author
Jonathan Corbet
committed
docs: kdoc: emit a warning for ancient versions of Python
Versions of Python prior to 3.7 do not guarantee to remember the insertion order of dicts; since kernel-doc depends on that guarantee, running with such older versions could result in output with reordered sections. Python 3.9 is the minimum for the kernel as a whole, so this should not be a problem, but put in a warning just in case somebody tries to use something older. Suggested-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
1 parent 636d4d9 commit 40020fe

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

scripts/lib/kdoc/kdoc_parser.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
documentation comments
1313
"""
1414

15+
import sys
1516
import re
1617
from pprint import pformat
1718

@@ -238,6 +239,14 @@ def __init__(self, config, fname):
238239
# Place all potential outputs into an array
239240
self.entries = []
240241

242+
#
243+
# We need Python 3.7 for its "dicts remember the insertion
244+
# order" guarantee
245+
#
246+
if sys.version_info.major == 3 and sys.version_info.minor < 7:
247+
self.emit_msg(0,
248+
'Python 3.7 or later is required for correct results')
249+
241250
def emit_msg(self, ln, msg, warning=True):
242251
"""Emit a message"""
243252

0 commit comments

Comments
 (0)