Skip to content

Commit 7668322

Browse files
Merge branch 'master' into cgi-max-num-fields
2 parents ab0eb93 + 6f9c55d commit 7668322

18 files changed

+148
-103
lines changed

Doc/library/dis.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ operation is being performed, so the intermediate analysis object isn't useful:
149149
.. function:: dis(x=None, *, file=None, depth=None)
150150

151151
Disassemble the *x* object. *x* can denote either a module, a class, a
152-
method, a function, a generator, an asynchronous generator, a couroutine,
152+
method, a function, a generator, an asynchronous generator, a coroutine,
153153
a code object, a string of source code or a byte sequence of raw bytecode.
154154
For a module, it disassembles all functions. For a class, it disassembles
155155
all methods (including class and static methods). For a code object or

Doc/library/pathlib.rst

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,23 +1095,30 @@ Below is a table mapping various :mod:`os` functions to their corresponding
10951095
overlapping use-cases, their semantics differ enough to warrant not
10961096
considering them equivalent.
10971097

1098-
============================ ==============================
1099-
os and os.path pathlib
1100-
============================ ==============================
1101-
:func:`os.path.abspath` :meth:`Path.resolve`
1102-
:func:`os.getcwd` :func:`Path.cwd`
1103-
:func:`os.path.exists` :meth:`Path.exists`
1104-
:func:`os.path.expanduser` :meth:`Path.expanduser` and
1105-
:meth:`Path.home`
1106-
:func:`os.path.isdir` :meth:`Path.is_dir`
1107-
:func:`os.path.isfile` :meth:`Path.is_file`
1108-
:func:`os.path.islink` :meth:`Path.is_symlink`
1109-
:func:`os.stat` :meth:`Path.stat`,
1110-
:meth:`Path.owner`,
1111-
:meth:`Path.group`
1112-
:func:`os.path.isabs` :meth:`PurePath.is_absolute`
1113-
:func:`os.path.join` :func:`PurePath.joinpath`
1114-
:func:`os.path.basename` :data:`PurePath.name`
1115-
:func:`os.path.dirname` :data:`PurePath.parent`
1116-
:func:`os.path.splitext` :data:`PurePath.suffix`
1117-
============================ ==============================
1098+
==================================== ==============================
1099+
os and os.path pathlib
1100+
==================================== ==============================
1101+
:func:`os.path.abspath` :meth:`Path.resolve`
1102+
:func:`os.chmod` :meth:`Path.chmod`
1103+
:func:`os.mkdir` :meth:`Path.mkdir`
1104+
:func:`os.rename` :meth:`Path.rename`
1105+
:func:`os.replace` :meth:`Path.replace`
1106+
:func:`os.rmdir` :meth:`Path.rmdir`
1107+
:func:`os.remove`, :func:`os.unlink` :meth:`Path.unlink`
1108+
:func:`os.getcwd` :func:`Path.cwd`
1109+
:func:`os.path.exists` :meth:`Path.exists`
1110+
:func:`os.path.expanduser` :meth:`Path.expanduser` and
1111+
:meth:`Path.home`
1112+
:func:`os.path.isdir` :meth:`Path.is_dir`
1113+
:func:`os.path.isfile` :meth:`Path.is_file`
1114+
:func:`os.path.islink` :meth:`Path.is_symlink`
1115+
:func:`os.stat` :meth:`Path.stat`,
1116+
:meth:`Path.owner`,
1117+
:meth:`Path.group`
1118+
:func:`os.path.isabs` :meth:`PurePath.is_absolute`
1119+
:func:`os.path.join` :func:`PurePath.joinpath`
1120+
:func:`os.path.basename` :data:`PurePath.name`
1121+
:func:`os.path.dirname` :data:`PurePath.parent`
1122+
:func:`os.path.samefile` :meth:`Path.samefile`
1123+
:func:`os.path.splitext` :data:`PurePath.suffix`
1124+
==================================== ==============================

Doc/library/ssl.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2658,7 +2658,7 @@ of TLS/SSL. Some new TLS 1.3 features are not yet available.
26582658
- TLS 1.3 uses a disjunct set of cipher suites. All AES-GCM and
26592659
ChaCha20 cipher suites are enabled by default. The method
26602660
:meth:`SSLContext.set_ciphers` cannot enable or disable any TLS 1.3
2661-
ciphers yet, but :meth:`SSLContext.get_cipers` returns them.
2661+
ciphers yet, but :meth:`SSLContext.get_ciphers` returns them.
26622662
- Session tickets are no longer sent as part of the initial handshake and
26632663
are handled differently. :attr:`SSLSocket.session` and :class:`SSLSession`
26642664
are not compatible with TLS 1.3.

Doc/library/zipapp.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ Pack up a directory into an archive, and run it.
195195
$ python myapp.pyz
196196
<output from myapp>
197197
198-
The same can be done using the :func:`create_archive` functon::
198+
The same can be done using the :func:`create_archive` function::
199199

200200
>>> import zipapp
201201
>>> zipapp.create_archive('myapp.pyz', 'myapp')

Doc/whatsnew/3.6.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1623,7 +1623,7 @@ a class variable and should not be set on instances of that class.
16231623
<https://github.com/python/typing/pull/280>`_.)
16241624

16251625
A new :const:`~typing.TYPE_CHECKING` constant that is assumed to be
1626-
``True`` by the static type chekers, but is ``False`` at runtime.
1626+
``True`` by the static type checkers, but is ``False`` at runtime.
16271627
(Contributed by Guido van Rossum in `Github #230
16281628
<https://github.com/python/typing/issues/230>`_.)
16291629

Lib/bdb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def trace_dispatch(self, frame, event, arg):
7474
return: A function or other code block is about to return.
7575
exception: An exception has occurred.
7676
c_call: A C function is about to be called.
77-
c_return: A C functon has returned.
77+
c_return: A C function has returned.
7878
c_exception: A C function has raised an exception.
7979
8080
For the Python events, specialized functions (see the dispatch_*()

Lib/inspect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1988,7 +1988,7 @@ def _signature_fromstr(cls, obj, s, skip_bound_arg=True):
19881988
module = sys.modules.get(module_name, None)
19891989
if module:
19901990
module_dict = module.__dict__
1991-
sys_module_dict = sys.modules
1991+
sys_module_dict = sys.modules.copy()
19921992

19931993
def parse_name(node):
19941994
assert isinstance(node, ast.arg)

Lib/ssl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ class SSLObject:
640640
641641
When compared to ``SSLSocket``, this object lacks the following features:
642642
643-
* Any form of network IO incluging methods such as ``recv`` and ``send``.
643+
* Any form of network IO, including methods such as ``recv`` and ``send``.
644644
* The ``do_handshake_on_connect`` and ``suppress_ragged_eofs`` machinery.
645645
"""
646646
def __init__(self, *args, **kwargs):

Lib/test/test_inspect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ def test_getfullargspec_builtin_methods(self):
851851
@cpython_only
852852
@unittest.skipIf(MISSING_C_DOCSTRINGS,
853853
"Signature information for builtins requires docstrings")
854-
def test_getfullagrspec_builtin_func(self):
854+
def test_getfullargspec_builtin_func(self):
855855
import _testcapi
856856
builtin = _testcapi.docstring_with_signature_with_defaults
857857
spec = inspect.getfullargspec(builtin)
@@ -860,7 +860,7 @@ def test_getfullagrspec_builtin_func(self):
860860
@cpython_only
861861
@unittest.skipIf(MISSING_C_DOCSTRINGS,
862862
"Signature information for builtins requires docstrings")
863-
def test_getfullagrspec_builtin_func_no_signature(self):
863+
def test_getfullargspec_builtin_func_no_signature(self):
864864
import _testcapi
865865
builtin = _testcapi.docstring_no_signature
866866
with self.assertRaises(TypeError):

Makefile.pre.in

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ PY_CFLAGS_NODIST=$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST)
9898
PY_CPPFLAGS= $(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $(CPPFLAGS)
9999
PY_LDFLAGS= $(CONFIGURE_LDFLAGS) $(LDFLAGS)
100100
NO_AS_NEEDED= @NO_AS_NEEDED@
101-
LDLAST= @LDLAST@
102101
SGI_ABI= @SGI_ABI@
103102
CCSHARED= @CCSHARED@
104103
LINKFORSHARED= @LINKFORSHARED@
@@ -568,7 +567,7 @@ clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c
568567

569568
# Build the interpreter
570569
$(BUILDPYTHON): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
571-
$(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
570+
$(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS)
572571

573572
platform: $(BUILDPYTHON) pybuilddir.txt
574573
$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform
@@ -623,21 +622,21 @@ $(LIBRARY): $(LIBRARY_OBJS)
623622

624623
libpython$(LDVERSION).so: $(LIBRARY_OBJS)
625624
if test $(INSTSONAME) != $(LDLIBRARY); then \
626-
$(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
625+
$(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM); \
627626
$(LN) -f $(INSTSONAME) $@; \
628627
else \
629-
$(BLDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
628+
$(BLDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM); \
630629
fi
631630

632631
libpython3.so: libpython$(LDVERSION).so
633632
$(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^
634633

635634
libpython$(LDVERSION).dylib: $(LIBRARY_OBJS)
636-
$(CC) -dynamiclib -Wl,-single_module $(PY_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
635+
$(CC) -dynamiclib -Wl,-single_module $(PY_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
637636

638637

639638
libpython$(VERSION).sl: $(LIBRARY_OBJS)
640-
$(LDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
639+
$(LDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM)
641640

642641
# Copy up the gdb python hooks into a position where they can be automatically
643642
# loaded by gdb during Lib/test/test_gdb.py
@@ -677,7 +676,7 @@ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
677676
$(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS)
678677
if test -n "$(DLLLIBRARY)"; then \
679678
$(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
680-
$(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST); \
679+
$(LIBS) $(MODLIBS) $(SYSLIBS); \
681680
else true; \
682681
fi
683682

@@ -699,15 +698,15 @@ Makefile Modules/config.c: Makefile.pre \
699698

700699

701700
Programs/_testembed: Programs/_testembed.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
702-
$(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
701+
$(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS)
703702

704703
############################################################################
705704
# Importlib
706705

707706
Programs/_freeze_importlib.o: Programs/_freeze_importlib.c Makefile
708707

709708
Programs/_freeze_importlib: Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN)
710-
$(LINKCC) $(PY_LDFLAGS) -o $@ Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
709+
$(LINKCC) $(PY_LDFLAGS) -o $@ Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LIBS) $(MODLIBS) $(SYSLIBS)
711710

712711
.PHONY: regen-importlib
713712
regen-importlib: Programs/_freeze_importlib
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
On Cygwin and MinGW, ensure that ``sys.executable`` always includes the full
2+
filename in the path, including the ``.exe`` suffix (unless it is a symbolic
3+
link).
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix inspect module polluted ``sys.modules`` when parsing
2+
``__text_signature__`` of callable.

Modules/_elementtree.c

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3685,30 +3685,25 @@ _elementtree_XMLParser__setevents_impl(XMLParserObject *self,
36853685
Py_RETURN_NONE;
36863686
}
36873687

3688-
static PyObject*
3689-
xmlparser_getattro(XMLParserObject* self, PyObject* nameobj)
3690-
{
3691-
if (PyUnicode_Check(nameobj)) {
3692-
PyObject* res;
3693-
if (_PyUnicode_EqualToASCIIString(nameobj, "entity"))
3694-
res = self->entity;
3695-
else if (_PyUnicode_EqualToASCIIString(nameobj, "target"))
3696-
res = self->target;
3697-
else if (_PyUnicode_EqualToASCIIString(nameobj, "version")) {
3698-
return PyUnicode_FromFormat(
3699-
"Expat %d.%d.%d", XML_MAJOR_VERSION,
3700-
XML_MINOR_VERSION, XML_MICRO_VERSION);
3701-
}
3702-
else
3703-
goto generic;
3688+
static PyMemberDef xmlparser_members[] = {
3689+
{"entity", T_OBJECT, offsetof(XMLParserObject, entity), READONLY, NULL},
3690+
{"target", T_OBJECT, offsetof(XMLParserObject, target), READONLY, NULL},
3691+
{NULL}
3692+
};
37043693

3705-
Py_INCREF(res);
3706-
return res;
3707-
}
3708-
generic:
3709-
return PyObject_GenericGetAttr((PyObject*) self, nameobj);
3694+
static PyObject*
3695+
xmlparser_version_getter(XMLParserObject *self, void *closure)
3696+
{
3697+
return PyUnicode_FromFormat(
3698+
"Expat %d.%d.%d", XML_MAJOR_VERSION,
3699+
XML_MINOR_VERSION, XML_MICRO_VERSION);
37103700
}
37113701

3702+
static PyGetSetDef xmlparser_getsetlist[] = {
3703+
{"version", (getter)xmlparser_version_getter, NULL, NULL},
3704+
{NULL},
3705+
};
3706+
37123707
#include "clinic/_elementtree.c.h"
37133708

37143709
static PyMethodDef element_methods[] = {
@@ -3890,7 +3885,7 @@ static PyTypeObject XMLParser_Type = {
38903885
0, /* tp_hash */
38913886
0, /* tp_call */
38923887
0, /* tp_str */
3893-
(getattrofunc)xmlparser_getattro, /* tp_getattro */
3888+
0, /* tp_getattro */
38943889
0, /* tp_setattro */
38953890
0, /* tp_as_buffer */
38963891
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,
@@ -3903,8 +3898,8 @@ static PyTypeObject XMLParser_Type = {
39033898
0, /* tp_iter */
39043899
0, /* tp_iternext */
39053900
xmlparser_methods, /* tp_methods */
3906-
0, /* tp_members */
3907-
0, /* tp_getset */
3901+
xmlparser_members, /* tp_members */
3902+
xmlparser_getsetlist, /* tp_getset */
39083903
0, /* tp_base */
39093904
0, /* tp_dict */
39103905
0, /* tp_descr_get */

Modules/_ssl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *s)
273273
#error "Py_SSL_DEFAULT_CIPHERS 0 needs Py_SSL_DEFAULT_CIPHER_STRING"
274274
#endif
275275
#elif PY_SSL_DEFAULT_CIPHERS == 1
276-
/* Python custom selection of sensible ciper suites
276+
/* Python custom selection of sensible cipher suites
277277
* DEFAULT: OpenSSL's default cipher list. Since 1.0.2 the list is in sensible order.
278278
* !aNULL:!eNULL: really no NULL ciphers
279279
* !MD5:!3DES:!DES:!RC4:!IDEA:!SEED: no weak or broken algorithms on old OpenSSL versions.

Modules/getpath.c

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,41 @@ absolutize(wchar_t *path)
296296
}
297297

298298

299+
#if defined(__CYGWIN__) || defined(__MINGW32__)
300+
/* add_exe_suffix requires that progpath be allocated at least
301+
MAXPATHLEN + 1 bytes.
302+
*/
303+
304+
#ifndef EXE_SUFFIX
305+
#define EXE_SUFFIX L".exe"
306+
#endif
307+
308+
static void
309+
add_exe_suffix(wchar_t *progpath)
310+
{
311+
/* Check for already have an executable suffix */
312+
size_t n = wcslen(progpath);
313+
size_t s = wcslen(EXE_SUFFIX);
314+
if (wcsncasecmp(EXE_SUFFIX, progpath+n-s, s) != 0) {
315+
if (n + s > MAXPATHLEN) {
316+
Py_FatalError("progpath overflow in getpath.c's add_exe_suffix()");
317+
}
318+
/* Save original path for revert */
319+
wchar_t orig[MAXPATHLEN+1];
320+
wcsncpy(orig, progpath, MAXPATHLEN);
321+
322+
wcsncpy(progpath+n, EXE_SUFFIX, s);
323+
progpath[n+s] = '\0';
324+
325+
if (!isxfile(progpath)) {
326+
/* Path that added suffix is invalid */
327+
wcsncpy(progpath, orig, MAXPATHLEN);
328+
}
329+
}
330+
}
331+
#endif
332+
333+
299334
/* search_for_prefix requires that argv0_path be no more than MAXPATHLEN
300335
bytes long.
301336
*/
@@ -605,6 +640,16 @@ calculate_program_full_path(const _PyCoreConfig *core_config,
605640
if (program_full_path[0] != SEP && program_full_path[0] != '\0') {
606641
absolutize(program_full_path);
607642
}
643+
#if defined(__CYGWIN__) || defined(__MINGW32__)
644+
/* For these platforms it is necessary to ensure that the .exe suffix
645+
* is appended to the filename, otherwise there is potential for
646+
* sys.executable to return the name of a directory under the same
647+
* path (bpo-28441).
648+
*/
649+
if (program_full_path[0] != '\0') {
650+
add_exe_suffix(program_full_path);
651+
}
652+
#endif
608653

609654
config->program_full_path = _PyMem_RawWcsdup(program_full_path);
610655
if (config->program_full_path == NULL) {

0 commit comments

Comments
 (0)