Skip to content

Commit 6189ebb

Browse files
author
Autobuild bot on TravisCI
committed
Merge remote-tracking branch 'upstream/3.10' into catalog-3.10 by Autobuild bot on TravisCI
2 parents d710d53 + 1204dfc commit 6189ebb

File tree

9 files changed

+48
-8
lines changed

9 files changed

+48
-8
lines changed

Doc/bugs.rst

+4
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ taken on the bug.
8080
Article which goes into some detail about how to create a useful bug report.
8181
This describes what kind of information is useful and why it is useful.
8282

83+
`Bug Writing Guidelines <https://bugzilla.mozilla.org/page.cgi?id=bug-writing.html>`_
84+
Information about writing a good bug report. Some of this is specific to the
85+
Mozilla project, but describes general good practices.
86+
8387
.. _contributing-to-python:
8488

8589
Getting started contributing to Python yourself

Doc/library/ipaddress.rst

+5
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ write code that handles both IP versions correctly. Address objects are
132132
The above change was also included in Python 3.9 starting with
133133
version 3.9.5.
134134

135+
.. versionchanged:: 3.8.12
136+
137+
The above change was also included in Python 3.8 starting with
138+
version 3.8.12.
139+
135140
.. attribute:: version
136141

137142
The appropriate version number: ``4`` for IPv4, ``6`` for IPv6.

Doc/whatsnew/3.8.rst

+13
Original file line numberDiff line numberDiff line change
@@ -2248,3 +2248,16 @@ separator key, with ``&`` as the default. This change also affects
22482248
functions internally. For more details, please see their respective
22492249
documentation.
22502250
(Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)
2251+
2252+
Notable changes in Python 3.8.12
2253+
================================
2254+
2255+
Starting with Python 3.8.12 the :mod:`ipaddress` module no longer accepts
2256+
any leading zeros in IPv4 address strings. Leading zeros are ambiguous and
2257+
interpreted as octal notation by some libraries. For example the legacy
2258+
function :func:`socket.inet_aton` treats leading zeros as octal notation.
2259+
glibc implementation of modern :func:`~socket.inet_pton` does not accept
2260+
any leading zeros.
2261+
2262+
(Originally contributed by Christian Heimes in :issue:`36384`, and backported
2263+
to 3.8 by Achraf Merzouki.)

Grammar/python.gram

+1-1
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ invalid_group:
947947
| '(' a='**' expression ')' {
948948
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "cannot use double starred expression here") }
949949
invalid_import_from_targets:
950-
| import_from_as_names ',' {
950+
| import_from_as_names ',' NEWLINE {
951951
RAISE_SYNTAX_ERROR("trailing comma not allowed without surrounding parentheses") }
952952

953953
invalid_with_stmt:

Lib/test/test_readline.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,15 @@ def test_init(self):
156156

157157
def test_auto_history_enabled(self):
158158
output = run_pty(self.auto_history_script.format(True))
159-
self.assertIn(b"History length: 1\r\n", output)
159+
# bpo-44949: Sometimes, the newline character is not written at the
160+
# end, so don't expect it in the output.
161+
self.assertIn(b"History length: 1", output)
160162

161163
def test_auto_history_disabled(self):
162164
output = run_pty(self.auto_history_script.format(False))
163-
self.assertIn(b"History length: 0\r\n", output)
165+
# bpo-44949: Sometimes, the newline character is not written at the
166+
# end, so don't expect it in the output.
167+
self.assertIn(b"History length: 0", output)
164168

165169
def test_nonascii(self):
166170
loc = locale.setlocale(locale.LC_CTYPE, None)

Lib/test/test_syntax.py

+7
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,13 @@
12021202
Traceback (most recent call last):
12031203
SyntaxError: trailing comma not allowed without surrounding parentheses
12041204
1205+
# Check that we dont raise the "trailing comma" error if there is more
1206+
# input to the left of the valid part that we parsed.
1207+
1208+
>>> from t import x,y, and 3
1209+
Traceback (most recent call last):
1210+
SyntaxError: invalid syntax
1211+
12051212
>>> (): int
12061213
Traceback (most recent call last):
12071214
SyntaxError: only single target (not tuple) can be annotated
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Refine the syntax error for trailing commas in import statements. Patch by
2+
Pablo Galindo.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix auto history tests of test_readline: sometimes, the newline character is
2+
not written at the end, so don't expect it in the output.

Parser/parser.c

+8-5
Original file line numberDiff line numberDiff line change
@@ -19607,7 +19607,7 @@ invalid_group_rule(Parser *p)
1960719607
return _res;
1960819608
}
1960919609

19610-
// invalid_import_from_targets: import_from_as_names ','
19610+
// invalid_import_from_targets: import_from_as_names ',' NEWLINE
1961119611
static void *
1961219612
invalid_import_from_targets_rule(Parser *p)
1961319613
{
@@ -19618,21 +19618,24 @@ invalid_import_from_targets_rule(Parser *p)
1961819618
}
1961919619
void * _res = NULL;
1962019620
int _mark = p->mark;
19621-
{ // import_from_as_names ','
19621+
{ // import_from_as_names ',' NEWLINE
1962219622
if (p->error_indicator) {
1962319623
D(p->level--);
1962419624
return NULL;
1962519625
}
19626-
D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','"));
19626+
D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names ',' NEWLINE"));
1962719627
Token * _literal;
1962819628
asdl_alias_seq* import_from_as_names_var;
19629+
Token * newline_var;
1962919630
if (
1963019631
(import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names
1963119632
&&
1963219633
(_literal = _PyPegen_expect_token(p, 12)) // token=','
19634+
&&
19635+
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1963319636
)
1963419637
{
19635-
D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','"));
19638+
D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names ',' NEWLINE"));
1963619639
_res = RAISE_SYNTAX_ERROR ( "trailing comma not allowed without surrounding parentheses" );
1963719640
if (_res == NULL && PyErr_Occurred()) {
1963819641
p->error_indicator = 1;
@@ -19643,7 +19646,7 @@ invalid_import_from_targets_rule(Parser *p)
1964319646
}
1964419647
p->mark = _mark;
1964519648
D(fprintf(stderr, "%*c%s invalid_import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
19646-
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names ','"));
19649+
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names ',' NEWLINE"));
1964719650
}
1964819651
_res = NULL;
1964919652
done:

0 commit comments

Comments
 (0)