Skip to content

Commit 425b643

Browse files
Merge branch '3.13' into backport-d6855c8-3.13
2 parents 2a07de4 + 13c5575 commit 425b643

36 files changed

Lines changed: 1878 additions & 587 deletions

Doc/library/string.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,8 @@ attributes:
943943

944944
Alternatively, you can provide the entire regular expression pattern by
945945
overriding the class attribute *pattern*. If you do this, the value must be a
946-
regular expression object with four named capturing groups. The capturing
946+
regular expression pattern string, or a compiled regular expression
947+
object, with four named capturing groups. The capturing
947948
groups correspond to the rules given above, along with the invalid placeholder
948949
rule:
949950

Doc/library/tkinter.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1981,7 +1981,7 @@ Base and mixin classes
19811981

19821982
.. method:: winfo_exists()
19831983

1984-
Return ``1`` if the widget exists, ``0`` otherwise.
1984+
Return true if the widget exists, false otherwise.
19851985

19861986
.. method:: winfo_fpixels(number)
19871987

@@ -2020,7 +2020,7 @@ Base and mixin classes
20202020

20212021
.. method:: winfo_ismapped()
20222022

2023-
Return ``1`` if the widget is currently mapped, ``0`` otherwise.
2023+
Return true if the widget is currently mapped, false otherwise.
20242024

20252025
.. method:: winfo_manager()
20262026

@@ -2151,8 +2151,8 @@ Base and mixin classes
21512151

21522152
.. method:: winfo_viewable()
21532153

2154-
Return ``1`` if the widget and all of its ancestors up through the
2155-
nearest toplevel window are mapped, ``0`` otherwise.
2154+
Return true if the widget and all of its ancestors up through the
2155+
nearest toplevel window are mapped, false otherwise.
21562156

21572157
.. method:: winfo_visual()
21582158

@@ -5526,7 +5526,7 @@ Widget classes
55265526
.. method:: edit_modified(arg=None)
55275527

55285528
If *arg* is omitted, return the current state of the modified flag as
5529-
``0`` or ``1``; the flag is set automatically whenever the text is
5529+
true or false; the flag is set automatically whenever the text is
55305530
inserted or deleted.
55315531
Otherwise set the flag to the boolean *arg*.
55325532

Doc/tools/.nitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,4 @@ Doc/library/xml.sax.reader.rst
4040
Doc/library/xml.sax.rst
4141
Doc/library/xmlrpc.client.rst
4242
Doc/library/xmlrpc.server.rst
43-
Doc/whatsnew/2.4.rst
44-
Doc/whatsnew/2.5.rst
4543
Doc/whatsnew/2.6.rst

Doc/using/windows.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,9 +454,9 @@ on using nuget. What follows is a summary that is sufficient for Python
454454
developers.
455455

456456
The ``nuget.exe`` command line tool may be downloaded directly from
457-
``https://aka.ms/nugetclidl``, for example, using curl or PowerShell. With the
458-
tool, the latest version of Python for 64-bit or 32-bit machines is installed
459-
using::
457+
``https://dist.nuget.org/win-x86-commandline/latest/nuget.exe``, for example,
458+
using curl or PowerShell. With the tool, the latest version of Python for
459+
64-bit or 32-bit machines is installed using::
460460

461461
nuget.exe install python -ExcludeVersion -OutputDirectory .
462462
nuget.exe install pythonx86 -ExcludeVersion -OutputDirectory .

Doc/whatsnew/2.4.rst

Lines changed: 110 additions & 108 deletions
Large diffs are not rendered by default.

Doc/whatsnew/2.5.rst

Lines changed: 160 additions & 150 deletions
Large diffs are not rendered by default.

Include/internal/pycore_pylifecycle.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ extern int _Py_LegacyLocaleDetected(int warn);
111111
// Export for 'readline' shared extension
112112
PyAPI_FUNC(char*) _Py_SetLocaleFromEnv(int category);
113113

114-
// Export for special main.c string compiling with source tracebacks
115-
int _PyRun_SimpleStringFlagsWithName(const char *command, const char* name, PyCompilerFlags *flags);
116-
117114

118115
/* interpreter config */
119116

Include/internal/pycore_pythonrun.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,32 @@ extern "C" {
88
# error "this header requires Py_BUILD_CORE define"
99
#endif
1010

11-
extern int _PyRun_SimpleFileObject(
11+
extern PyObject* _PyRun_SimpleFile(
1212
FILE *fp,
1313
PyObject *filename,
1414
int closeit,
1515
PyCompilerFlags *flags);
1616

17-
extern int _PyRun_AnyFileObject(
17+
extern PyObject* _PyRun_AnyFile(
1818
FILE *fp,
1919
PyObject *filename,
2020
int closeit,
2121
PyCompilerFlags *flags);
2222

23-
extern int _PyRun_InteractiveLoopObject(
24-
FILE *fp,
25-
PyObject *filename,
26-
PyCompilerFlags *flags);
27-
2823
extern const char* _Py_SourceAsString(
2924
PyObject *cmd,
3025
const char *funcname,
3126
const char *what,
3227
PyCompilerFlags *cf,
3328
PyObject **cmd_copy);
3429

30+
// Export for special main.c string compiling with source tracebacks
31+
extern PyObject* _PyRun_SimpleString(
32+
const char *command,
33+
PyObject* name,
34+
PyCompilerFlags *flags);
35+
36+
3537
#ifdef __cplusplus
3638
}
3739
#endif

Lib/email/utils.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,13 @@ def parsedate_to_datetime(data):
317317
if parsed_date_tz is None:
318318
raise ValueError('Invalid date value or format "%s"' % str(data))
319319
*dtuple, tz = parsed_date_tz
320-
if tz is None:
321-
return datetime.datetime(*dtuple[:6])
322-
return datetime.datetime(*dtuple[:6],
323-
tzinfo=datetime.timezone(datetime.timedelta(seconds=tz)))
320+
try:
321+
if tz is None:
322+
return datetime.datetime(*dtuple[:6])
323+
return datetime.datetime(*dtuple[:6],
324+
tzinfo=datetime.timezone(datetime.timedelta(seconds=tz)))
325+
except OverflowError as exc:
326+
raise ValueError('Invalid date value or format "%s"' % str(data)) from exc
324327

325328

326329
def parseaddr(addr, *, strict=True):

Lib/imaplib.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@
140140
_quoted = re.compile(br'"(?:[^"\\]|\\.)*+"')
141141

142142

143+
def _paren_depth(data, depth=0):
144+
# Net parenthesis nesting of data, ignoring parentheses in quoted strings.
145+
data = _quoted.sub(b'', data)
146+
return depth + data.count(b'(') - data.count(b')')
147+
148+
143149
class IMAP4:
144150

145151
r"""IMAP4 client class.
@@ -797,7 +803,7 @@ def select(self, mailbox='INBOX', readonly=False):
797803
if __debug__:
798804
if self.debug >= 1:
799805
self._dump_ur(self.untagged_responses)
800-
raise self.readonly('%s is not writable' % mailbox)
806+
raise self.readonly('%r is not writable' % (mailbox,))
801807
return typ, self.untagged_responses.get('EXISTS', [None])
802808

803809

@@ -921,7 +927,7 @@ def uid(self, command, *args):
921927
"""
922928
command = command.upper()
923929
if not command in Commands:
924-
raise self.error("Unknown IMAP4 UID command: %s" % command)
930+
raise self.error("Unknown IMAP4 UID command: %r" % (command,))
925931
if self.state not in Commands[command]:
926932
raise self.error("command %s illegal in state %s, "
927933
"only allowed in states %s" %
@@ -1154,6 +1160,11 @@ def _get_response(self):
11541160

11551161
resp = self._get_line()
11561162

1163+
# Skip spurious blank lines between responses (some servers send one
1164+
# after a literal that ends a response).
1165+
while resp == b'':
1166+
resp = self._get_line()
1167+
11571168
# Command completion response?
11581169

11591170
if self._match(self.tagre, resp):
@@ -1191,6 +1202,7 @@ def _get_response(self):
11911202

11921203
# Is there a literal to come?
11931204

1205+
depth = 0 # open parenthesis nesting so far
11941206
while self._match(self.Literal, dat):
11951207

11961208
# Read literal direct from connection.
@@ -1204,13 +1216,15 @@ def _get_response(self):
12041216
# Store response with literal as tuple
12051217

12061218
self._append_untagged(typ, (dat, data))
1219+
depth = _paren_depth(dat, depth)
12071220

12081221
# Read trailer - possibly containing another literal
12091222

12101223
dat = self._get_line()
12111224

1212-
# Skip a blank line that some servers send after a literal.
1213-
if dat == b'':
1225+
# Skip spurious blank lines after a literal, but only inside an
1226+
# unclosed parenthesis (at top level they end the response).
1227+
while dat == b'' and depth > 0:
12141228
dat = self._get_line()
12151229

12161230
self._append_untagged(typ, dat)

0 commit comments

Comments
 (0)