Commit 7e0e863e authored by Charles-François Natali's avatar Charles-François Natali

Merge.

parents bba4bca9 72330dcf
......@@ -229,7 +229,8 @@ def main():
success = False
return success
else:
return compile_path(legacy=args.legacy)
return compile_path(legacy=args.legacy, force=args.force,
quiet=args.quiet)
except KeyboardInterrupt:
print("\n[interrupted]")
return False
......
......@@ -5,8 +5,6 @@ import os
import py_compile
import shutil
import struct
import subprocess
import sys
import tempfile
import time
import unittest
......@@ -181,6 +179,29 @@ class CommandLineTests(unittest.TestCase):
self.assertNotCompiled(self.initfn)
self.assertNotCompiled(self.barfn)
def test_no_args_respects_force_flag(self):
bazfn = script_helper.make_script(self.directory, 'baz', '')
self.assertRunOK(PYTHONPATH=self.directory)
pycpath = importlib.util.cache_from_source(bazfn)
# Set atime/mtime backward to avoid file timestamp resolution issues
os.utime(pycpath, (time.time()-60,)*2)
mtime = os.stat(pycpath).st_mtime
# Without force, no recompilation
self.assertRunOK(PYTHONPATH=self.directory)
mtime2 = os.stat(pycpath).st_mtime
self.assertEqual(mtime, mtime2)
# Now force it.
self.assertRunOK('-f', PYTHONPATH=self.directory)
mtime2 = os.stat(pycpath).st_mtime
self.assertNotEqual(mtime, mtime2)
def test_no_args_respects_quiet_flag(self):
script_helper.make_script(self.directory, 'baz', '')
noisy = self.assertRunOK(PYTHONPATH=self.directory)
self.assertIn(b'Listing ', noisy)
quiet = self.assertRunOK('-q', PYTHONPATH=self.directory)
self.assertNotIn(b'Listing ', quiet)
# Ensure that the default behavior of compileall's CLI is to create
# PEP 3147 pyc/pyo files.
for name, ext, switch in [
......
......@@ -15,6 +15,9 @@ try:
import ssl
except ImportError:
ssl = None
HAS_SNI = False
else:
from ssl import HAS_SNI
from unittest import TestCase, skipUnless
from test import support
......@@ -924,6 +927,7 @@ class TestTLS_FTPClass(TestCase):
self.client.ccc()
self.assertRaises(ValueError, self.client.sock.unwrap)
@skipUnless(HAS_SNI, 'No SNI support in ssl module')
def test_check_hostname(self):
self.client.quit()
ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
......
......@@ -18,6 +18,9 @@ try:
import ssl
except ImportError:
ssl = None
HAS_SNI = False
else:
from ssl import HAS_SNI
CERTFILE = None
CAFILE = None
......@@ -349,6 +352,7 @@ class ThreadedNetworkedTestsSSL(BaseThreadedNetworkedTests):
imap_class = IMAP4_SSL
@reap_threads
@unittest.skipUnless(HAS_SNI, 'No SNI support in ssl module')
def test_ssl_verified(self):
ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
ssl_context.verify_mode = ssl.CERT_REQUIRED
......
......@@ -21,10 +21,14 @@ PORT = 0
SUPPORTS_SSL = False
if hasattr(poplib, 'POP3_SSL'):
import ssl
from ssl import HAS_SNI
SUPPORTS_SSL = True
CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir, "keycert3.pem")
CAFILE = os.path.join(os.path.dirname(__file__) or os.curdir, "pycacert.pem")
else:
HAS_SNI = False
requires_ssl = skipUnless(SUPPORTS_SSL, 'SSL not supported')
# the dummy data returned by server when LIST and RETR commands are issued
......@@ -330,6 +334,7 @@ class TestPOP3Class(TestCase):
self.assertEqual(resp, expected)
@requires_ssl
@skipUnless(HAS_SNI, 'No SNI support in ssl module')
def test_stls_context(self):
expected = b'+OK Begin TLS negotiation'
ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
......
......@@ -1419,6 +1419,7 @@ class NetworkedTests(unittest.TestCase):
s.close()
self.assertEqual(len(ctx.get_ca_certs()), 1)
@needs_sni
def test_context_setget(self):
# Check that the context of a connected socket can be replaced.
with support.transient_internet("svn.python.org"):
......@@ -1970,6 +1971,7 @@ else:
cert = s.getpeercert()
self.assertTrue(cert, "Can't get peer certificate.")
@needs_sni
def test_check_hostname(self):
if support.verbose:
sys.stdout.write("\n")
......
......@@ -44,6 +44,9 @@ Core and Builtins
Library
-------
- Issue #19532: python -m compileall with no filename/directory arguments now
respects the -f and -q flags instead of ignoring them.
- Issue #19623: Fixed writing to unseekable files in the aifc module.
- Issue #19946: multiprocessing.spawn now raises ImportError when the module to
......
......@@ -4421,21 +4421,22 @@ mpd_qfma(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_t *c,
const mpd_context_t *ctx, uint32_t *status)
{
uint32_t workstatus = 0;
const mpd_t *cc = c;
mpd_t *cc = NULL;
if (result == c) {
if ((cc = mpd_qncopy(c)) == NULL) {
mpd_seterror(result, MPD_Malloc_error, status);
return;
}
c = cc;
}
_mpd_qmul(result, a, b, ctx, &workstatus);
if (!(workstatus&MPD_Invalid_operation)) {
mpd_qadd(result, result, cc, ctx, &workstatus);
mpd_qadd(result, result, c, ctx, &workstatus);
}
if (cc != c) mpd_del((mpd_t *)cc);
if (cc) mpd_del(cc);
*status |= workstatus;
}
......
......@@ -36,9 +36,6 @@ static PyObject _dummy_struct;
#define dummy (&_dummy_struct)
/* Exported for the gdb plugin's benefit. */
PyObject *_PySet_Dummy = dummy;
/* ======================================================================== */
/* ======= Begin logic for probing the hash table ========================= */
......@@ -2345,6 +2342,9 @@ _PySet_Update(PyObject *set, PyObject *iterable)
return set_update_internal((PySetObject *)set, iterable);
}
/* Exported for the gdb plugin's benefit. */
PyObject *_PySet_Dummy = dummy;
#ifdef Py_DEBUG
/* Test code to be called with any three element set.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment