Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ba4af49

Browse files
committed
Merged revisions 61964-61979 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r61964 | benjamin.peterson | 2008-03-27 01:25:33 +0100 (Thu, 27 Mar 2008) | 2 lines add commas for introductory clauses ........ r61965 | christian.heimes | 2008-03-27 02:36:21 +0100 (Thu, 27 Mar 2008) | 1 line Hopefully added _fileio module to the Windows build system ........ r61966 | christian.heimes | 2008-03-27 02:38:47 +0100 (Thu, 27 Mar 2008) | 1 line Revert commit accident ........ r61967 | neal.norwitz | 2008-03-27 04:49:54 +0100 (Thu, 27 Mar 2008) | 3 lines Fix bytes so it works on 64-bit platforms. (Also remove some #if 0 code that is already handled in _getbytevalue.) ........ r61968 | neal.norwitz | 2008-03-27 05:40:07 +0100 (Thu, 27 Mar 2008) | 1 line Fix memory leaks ........ r61969 | neal.norwitz | 2008-03-27 05:40:50 +0100 (Thu, 27 Mar 2008) | 3 lines Fix warnings about using char as an array subscript. This is not portable since char is signed on some platforms and unsigned on others. ........ r61970 | neal.norwitz | 2008-03-27 06:02:57 +0100 (Thu, 27 Mar 2008) | 1 line Fix test_compiler after adding unicode_literals ........ r61971 | neal.norwitz | 2008-03-27 06:03:11 +0100 (Thu, 27 Mar 2008) | 1 line Fix compiler warnings ........ r61972 | neal.norwitz | 2008-03-27 07:52:01 +0100 (Thu, 27 Mar 2008) | 1 line Pluralss only need one s, not 2 (intss -> ints) ........ r61973 | christian.heimes | 2008-03-27 10:02:33 +0100 (Thu, 27 Mar 2008) | 1 line Quick 'n dirty hack: Increase the magic by 2 to force a rebuild of pyc/pyo files on the build bots ........ r61974 | eric.smith | 2008-03-27 10:42:35 +0100 (Thu, 27 Mar 2008) | 3 lines Added test cases for single quoted strings, both forms of triple quotes, and some string concatenations. Removed unneeded __future__ print_function import. ........ r61975 | christian.heimes | 2008-03-27 11:35:52 +0100 (Thu, 27 Mar 2008) | 1 line Build bots are working again - removing the hack ........ r61976 | christian.heimes | 2008-03-27 12:46:37 +0100 (Thu, 27 Mar 2008) | 2 lines Fixed tokenize tests The tokenize module doesn't understand __future__.unicode_literals yet ........ r61977 | georg.brandl | 2008-03-27 14:27:31 +0100 (Thu, 27 Mar 2008) | 2 lines #2248: return result of QUIT from quit(). ........ r61978 | georg.brandl | 2008-03-27 14:34:59 +0100 (Thu, 27 Mar 2008) | 2 lines The bug for which there was a test in outstanding_bugs.py was agreed not to be a bug. ........ r61979 | amaury.forgeotdarc | 2008-03-28 00:23:54 +0100 (Fri, 28 Mar 2008) | 5 lines Issue2495: tokenize.untokenize did not insert space between two consecutive string literals: "" "" => """", which is invalid code. Will backport ........
1 parent 3a93212 commit ba4af49

14 files changed

Lines changed: 71 additions & 74 deletions

File tree

Doc/library/smtplib.rst

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,6 @@ An :class:`SMTP` instance has the following methods:
193193
:exc:SMTPHeloError
194194
The server didn't reply properly to the ``HELO`` greeting.
195195

196-
.. versionadded:: 2.6
197-
198196
.. method:: SMTP.has_extn(name)
199197

200198
Return :const:`True` if *name* is in the set of SMTP service extensions returned
@@ -243,16 +241,12 @@ An :class:`SMTP` instance has the following methods:
243241
If there has been no previous ``EHLO`` or ``HELO`` command this session,
244242
this method tries ESMTP ``EHLO`` first.
245243

246-
.. versionchanged:: 2.6
247-
248244
:exc:`SMTPHeloError`
249245
The server didn't reply properly to the ``HELO`` greeting.
250246

251247
:exc:`SMTPException`
252248
The server does not support the STARTTLS extension.
253249

254-
.. versionchanged:: 2.6
255-
256250
:exc:`RuntimeError`
257251
SSL/TLS support is not available to your python interpreter.
258252

@@ -311,7 +305,9 @@ An :class:`SMTP` instance has the following methods:
311305

312306
.. method:: SMTP.quit()
313307

314-
Terminate the SMTP session and close the connection.
308+
Terminate the SMTP session and close the connection. Return the result of
309+
the SMTP ``QUIT`` command.
310+
315311

316312
Low-level methods corresponding to the standard SMTP/ESMTP commands ``HELP``,
317313
``RSET``, ``NOOP``, ``MAIL``, ``RCPT``, and ``DATA`` are also supported.

Include/bytes_methods.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ extern const char _Py_swapcase__doc__[];
4444

4545
extern const unsigned int _Py_ctype_table[256];
4646

47-
#define ISLOWER(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_LOWER)
48-
#define ISUPPER(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_UPPER)
49-
#define ISALPHA(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_ALPHA)
50-
#define ISDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_DIGIT)
51-
#define ISXDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_XDIGIT)
52-
#define ISALNUM(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_ALNUM)
53-
#define ISSPACE(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_SPACE)
47+
#define ISLOWER(c) (_Py_ctype_table[(unsigned)Py_CHARMASK(c)] & FLAG_LOWER)
48+
#define ISUPPER(c) (_Py_ctype_table[(unsigned)Py_CHARMASK(c)] & FLAG_UPPER)
49+
#define ISALPHA(c) (_Py_ctype_table[(unsigned)Py_CHARMASK(c)] & FLAG_ALPHA)
50+
#define ISDIGIT(c) (_Py_ctype_table[(unsigned)Py_CHARMASK(c)] & FLAG_DIGIT)
51+
#define ISXDIGIT(c) (_Py_ctype_table[(unsigned)Py_CHARMASK(c)] & FLAG_XDIGIT)
52+
#define ISALNUM(c) (_Py_ctype_table[(unsigned)Py_CHARMASK(c)] & FLAG_ALNUM)
53+
#define ISSPACE(c) (_Py_ctype_table[(unsigned)Py_CHARMASK(c)] & FLAG_SPACE)
5454

5555
#undef islower
5656
#define islower(c) undefined_islower(c)

Lib/smtplib.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,8 +729,9 @@ def close(self):
729729

730730
def quit(self):
731731
"""Terminate the SMTP session."""
732-
self.docmd("quit")
732+
res = self.docmd("quit")
733733
self.close()
734+
return res
734735

735736
if _have_ssl:
736737

Lib/test/outstanding_bugs.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,6 @@
1313
# One test case for outstanding bugs at the moment:
1414
#
1515

16-
class TestDifflibLongestMatch(unittest.TestCase):
17-
# From Patch #1678339:
18-
# The find_longest_match method in the difflib's SequenceMatcher has a bug.
19-
20-
# The bug is in turn caused by a problem with creating a b2j mapping which
21-
# should contain a list of indices for each of the list elements in b.
22-
# However, when the b2j mapping is being created (this is being done in
23-
# __chain_b method in the SequenceMatcher) the mapping becomes broken. The
24-
# cause of this is that for the frequently used elements the list of indices
25-
# is removed and the element is being enlisted in the populardict mapping.
26-
27-
# The test case tries to match two strings like:
28-
# abbbbbb.... and ...bbbbbbc
29-
30-
# The number of b is equal and the find_longest_match should have returned
31-
# the proper amount. However, in case the number of "b"s is large enough, the
32-
# method reports that the length of the longest common substring is 0. It
33-
# simply can't find it.
34-
35-
# A bug was raised some time ago on this matter. It's ID is 1528074.
36-
37-
def test_find_longest_match(self):
38-
import difflib
39-
for i in (190, 200, 210):
40-
text1 = "a" + "b"*i
41-
text2 = "b"*i + "c"
42-
m = difflib.SequenceMatcher(None, text1, text2)
43-
(aptr, bptr, l) = m.find_longest_match(0, len(text1), 0, len(text2))
44-
self.assertEquals(i, l)
45-
self.assertEquals(aptr, 1)
46-
self.assertEquals(bptr, 0)
47-
4816
# test_io
4917
import io
5018
class TextIOWrapperTest(unittest.TestCase):
@@ -114,7 +82,6 @@ def test_issue1395_5(self):
11482

11583
def test_main():
11684
test_support.run_unittest(
117-
TestDifflibLongestMatch,
11885
TextIOWrapperTest)
11986

12087
if __name__ == "__main__":

Lib/test/test_future4.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import print_function
21
from __future__ import unicode_literals
32

43
import unittest

Lib/test/test_tokenize.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
8989
>>> roundtrip("try: import somemodule\\n"
9090
... "except ImportError: # comment\\n"
91-
... " print 'Can not import' # comment2\\n"
91+
... " print('Can not import' # comment2\\n)"
9292
... "else: print 'Loaded'\\n")
9393
True
9494
@@ -509,6 +509,28 @@
509509
True
510510
>>> roundtrip("# Comment \\\\nx = 0")
511511
True
512+
513+
Two string literals on the same line
514+
515+
>>> roundtrip("'' ''")
516+
True
517+
518+
Test roundtrip on random python modules.
519+
pass the '-ucompiler' option to process the full directory.
520+
521+
>>> import random
522+
>>> tempdir = os.path.dirname(f) or os.curdir
523+
>>> testfiles = glob.glob(os.path.join(tempdir, "test*.py"))
524+
525+
>>> if not test_support.is_resource_enabled("compiler"):
526+
... testfiles = random.sample(testfiles, 10)
527+
...
528+
>>> for testfile in testfiles:
529+
... if not roundtrip(open(testfile, 'rb')):
530+
... print("Roundtrip failed for file %s" % testfile)
531+
... break
532+
... else: True
533+
True
512534
"""
513535

514536
from test import test_support

Lib/tokenize.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ def compat(self, token, iterable):
178178
tokval += ' '
179179
if toknum in (NEWLINE, NL):
180180
startline = True
181+
prevstring = False
181182
for tok in iterable:
182183
toknum, tokval = tok[:2]
183184
if toknum == ENCODING:
@@ -187,6 +188,14 @@ def compat(self, token, iterable):
187188
if toknum in (NAME, NUMBER):
188189
tokval += ' '
189190

191+
# Insert a space between two consecutive strings
192+
if toknum == STRING:
193+
if prevstring:
194+
tokval = ' ' + tokval
195+
prevstring = True
196+
else:
197+
prevstring = False
198+
190199
if toknum == INDENT:
191200
indents.append(tokval)
192201
continue

Misc/ACKS

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
Acknowledgements
2-
----------------
1+
32

43
This list is not complete and not in any useful order, but I would
54
like to thank everybody who contributed in any way, with code, hints,
65
bug reports, ideas, moral support, endorsement, or even complaints....
7-
Without you I would've stopped working on Python long ago!
6+
Without you, I would've stopped working on Python long ago!
87

98
--Guido
109

11-
PS: In the standard Python distribution this file is encoded in Latin-1.
10+
PS: In the standard Python distribution, this file is encoded in Latin-1.
1211

1312
David Abrahams
1413
Jim Ahlstrom

Modules/_ssl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,7 +1518,7 @@ static void _ssl_thread_locking_function
15181518
*/
15191519

15201520
if ((_ssl_locks == NULL) ||
1521-
(n < 0) || (n >= _ssl_locks_count))
1521+
(n < 0) || ((unsigned)n >= _ssl_locks_count))
15221522
return;
15231523

15241524
if (mode & CRYPTO_LOCK) {
@@ -1530,7 +1530,7 @@ static void _ssl_thread_locking_function
15301530

15311531
static int _setup_ssl_threads(void) {
15321532

1533-
int i;
1533+
unsigned int i;
15341534

15351535
if (_ssl_locks == NULL) {
15361536
_ssl_locks_count = CRYPTO_num_locks();

Objects/bytesobject.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2609,17 +2609,21 @@ bytes_extend(PyBytesObject *self, PyObject *arg)
26092609
if (! _getbytevalue(item, &value)) {
26102610
Py_DECREF(item);
26112611
Py_DECREF(it);
2612+
PyMem_Free(buf);
26122613
return NULL;
26132614
}
26142615
buf[len++] = value;
26152616
Py_DECREF(item);
26162617
if (len >= buf_size) {
2618+
char *new_buf;
26172619
buf_size = len + (len >> 1) + 1;
2618-
buf = (char *)PyMem_Realloc(buf, buf_size * sizeof(char));
2619-
if (buf == NULL) {
2620+
new_buf = (char *)PyMem_Realloc(buf, buf_size * sizeof(char));
2621+
if (new_buf == NULL) {
26202622
Py_DECREF(it);
2623+
PyMem_Free(buf);
26212624
return PyErr_NoMemory();
26222625
}
2626+
buf = new_buf;
26232627
}
26242628
}
26252629
Py_DECREF(it);

0 commit comments

Comments
 (0)