Skip to content

Commit 0cbc063

Browse files
committed
merge from 3.3
Fix #17967 - Fix related to regression on Windows. os.path.join(*self.dirs) produces an invalid path on windows. ftp paths are always forward-slash seperated like this. /pub/dir.
2 parents 96190ee + a594d61 commit 0cbc063

897 files changed

Lines changed: 53720 additions & 73575 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Lib/plat-mac/errors.rsrc.df.rsrc
2020
Makefile
2121
Makefile.pre
2222
Misc/python.pc
23+
Misc/python-config.sh
2324
Modules/Setup
2425
Modules/Setup.config
2526
Modules/Setup.local
@@ -57,6 +58,8 @@ platform
5758
pybuilddir.txt
5859
pyconfig.h
5960
python
61+
python-config
62+
python-config.py
6063
python.exe
6164
python-gdb.py
6265
python.exe-gdb.py

.hgignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ platform$
1818
pyconfig.h$
1919
python$
2020
python.exe$
21+
python-config$
22+
python-config.py$
2123
reflog.txt$
2224
tags$
2325
Lib/plat-mac/errors.rsrc.df.rsrc
@@ -27,6 +29,7 @@ Doc/tools/jinja/
2729
Doc/tools/jinja2/
2830
Doc/tools/pygments/
2931
Misc/python.pc
32+
Misc/python-config.sh$
3033
Modules/Setup$
3134
Modules/Setup.config
3235
Modules/Setup.local

Doc/c-api/dict.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,15 @@ Dictionary Objects
110110
:c:type:`char\*`, rather than a :c:type:`PyObject\*`.
111111
112112
113+
.. c:function:: PyObject* PyDict_SetDefault(PyObject *p, PyObject *key, PyObject *default)
114+
115+
This is the same as the Python-level :meth:`dict.setdefault`. If present, it
116+
returns the value corresponding to *key* from the dictionary *p*. If the key
117+
is not in the dict, it is inserted with value *defaultobj* and *defaultobj*
118+
is returned. This function evaluates the hash function of *key* only once,
119+
instead of evaluating it independently for the lookup and the insertion.
120+
121+
113122
.. c:function:: PyObject* PyDict_Items(PyObject *p)
114123
115124
Return a :c:type:`PyListObject` containing all the items from the dictionary.

Doc/c-api/init.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,20 @@ with sub-interpreters:
654654
made on the main thread. This is mainly a helper/diagnostic function.
655655
656656
657+
.. c:function:: int PyGILState_Check()
658+
659+
Return 1 if the current thread is holding the GIL and 0 otherwise.
660+
This function can be called from any thread at any time.
661+
Only if it has had its Python thread state initialized and currently is
662+
holding the GIL will it return 1.
663+
This is mainly a helper/diagnostic function. It can be useful
664+
for example in callback contexts or memory allocation functions when
665+
knowing that the GIL is locked can allow the caller to perform sensitive
666+
actions or otherwise behave differently.
667+
668+
.. versionadded:: 3.4
669+
670+
657671
The following macros are normally used without a trailing semicolon; look for
658672
example usage in the Python source distribution.
659673

Doc/c-api/module.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,20 @@ There are only a few functions special to module objects.
3535
single: __name__ (module attribute)
3636
single: __doc__ (module attribute)
3737
single: __file__ (module attribute)
38+
single: __package__ (module attribute)
39+
single: __loader__ (module attribute)
3840
3941
Return a new module object with the :attr:`__name__` attribute set to *name*.
40-
Only the module's :attr:`__doc__` and :attr:`__name__` attributes are filled in;
41-
the caller is responsible for providing a :attr:`__file__` attribute.
42+
The module's :attr:`__name__`, :attr:`__doc__`, :attr:`__package__`, and
43+
:attr:`__loader__` attributes are filled in (all but :attr:`__name__` are set
44+
to ``None``); the caller is responsible for providing a :attr:`__file__`
45+
attribute.
4246
4347
.. versionadded:: 3.3
4448
49+
.. versionchanged:: 3.4
50+
:attr:`__package__` and :attr:`__loader__` are set to ``None``.
51+
4552
4653
.. c:function:: PyObject* PyModule_New(const char *name)
4754

Doc/c-api/object.rst

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ is considered sufficient for this determination.
240240
of the Python expression ``callable_object(*args)``.
241241
242242
243-
.. c:function:: PyObject* PyObject_CallFunction(PyObject *callable, char *format, ...)
243+
.. c:function:: PyObject* PyObject_CallFunction(PyObject *callable, const char *format, ...)
244244
245245
Call a callable Python object *callable*, with a variable number of C arguments.
246246
The C arguments are described using a :c:func:`Py_BuildValue` style format
@@ -250,8 +250,11 @@ is considered sufficient for this determination.
250250
pass :c:type:`PyObject \*` args, :c:func:`PyObject_CallFunctionObjArgs` is a
251251
faster alternative.
252252
253+
.. versionchanged:: 3.4
254+
The type of *format* was changed from ``char *``.
253255
254-
.. c:function:: PyObject* PyObject_CallMethod(PyObject *o, char *method, char *format, ...)
256+
257+
.. c:function:: PyObject* PyObject_CallMethod(PyObject *o, const char *method, const char *format, ...)
255258
256259
Call the method named *method* of object *o* with a variable number of C
257260
arguments. The C arguments are described by a :c:func:`Py_BuildValue` format
@@ -261,6 +264,9 @@ is considered sufficient for this determination.
261264
Note that if you only pass :c:type:`PyObject \*` args,
262265
:c:func:`PyObject_CallMethodObjArgs` is a faster alternative.
263266
267+
.. versionchanged:: 3.4
268+
The types of *method* and *format* were changed from ``char *``.
269+
264270
265271
.. c:function:: PyObject* PyObject_CallFunctionObjArgs(PyObject *callable, ..., NULL)
266272
@@ -342,6 +348,15 @@ is considered sufficient for this determination.
342348
returned. This is the equivalent to the Python expression ``len(o)``.
343349
344350
351+
.. c:function:: Py_ssize_t PyObject_LengthHint(PyObject *o, Py_ssize_t default)
352+
353+
Return an estimated length for the object *o*. First trying to return its
354+
actual length, then an estimate using ``__length_hint__``, and finally
355+
returning the default value. On error ``-1`` is returned. This is the
356+
equivalent to the Python expression ``operator.length_hint(o, default)``.
357+
358+
.. versionadded:: 3.4
359+
345360
.. c:function:: PyObject* PyObject_GetItem(PyObject *o, PyObject *key)
346361
347362
Return element of *o* corresponding to the object *key* or *NULL* on failure.

Doc/c-api/unicode.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,12 +526,23 @@ APIs:
526526
The `"%lld"` and `"%llu"` format specifiers are only available
527527
when :const:`HAVE_LONG_LONG` is defined.
528528
529+
.. note::
530+
The width formatter unit is number of characters rather than bytes.
531+
The precision formatter unit is number of bytes for ``"%s"`` and
532+
``"%V"`` (if the ``PyObject*`` argument is NULL), and a number of
533+
characters for ``"%A"``, ``"%U"``, ``"%S"``, ``"%R"`` and ``"%V"``
534+
(if the ``PyObject*`` argument is not NULL).
535+
529536
.. versionchanged:: 3.2
530537
Support for ``"%lld"`` and ``"%llu"`` added.
531538
532539
.. versionchanged:: 3.3
533540
Support for ``"%li"``, ``"%lli"`` and ``"%zi"`` added.
534541
542+
.. versionchanged:: 3.4
543+
Support width and precision formatter for ``"%s"``, ``"%A"``, ``"%U"``,
544+
``"%V"``, ``"%S"``, ``"%R"`` added.
545+
535546
536547
.. c:function:: PyObject* PyUnicode_FromFormatV(const char *format, va_list vargs)
537548

Doc/c-api/veryhigh.rst

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,29 @@ the same library that the Python runtime is using.
144144
(:func:`sys.getfilesystemencoding`). Returns ``0`` at EOF.
145145
146146
147+
.. c:var:: int (*PyOS_InputHook)(void)
148+
149+
Can be set to point to a function with the prototype
150+
``int func(void)``. The function will be called when Python's
151+
interpreter prompt is about to become idle and wait for user input
152+
from the terminal. The return value is ignored. Overriding this
153+
hook can be used to integrate the interpreter's prompt with other
154+
event loops, as done in the :file:`Modules/_tkinter.c` in the
155+
Python source code.
156+
157+
158+
.. c:var:: char* (*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *)
159+
160+
Can be set to point to a function with the prototype
161+
``char *func(FILE *stdin, FILE *stdout, char *prompt)``,
162+
overriding the default function used to read a single line of input
163+
at the interpreter's prompt. The function is expected to output
164+
the string *prompt* if it's not *NULL*, and then read a line of
165+
input from the provided standard input file, returning the
166+
resulting string. For example, The :mod:`readline` module sets
167+
this hook to provide line-editing and tab-completion features.
168+
169+
147170
.. c:function:: struct _node* PyParser_SimpleParseString(const char *str, int start)
148171
149172
This is a simplified interface to
@@ -338,4 +361,3 @@ the same library that the Python runtime is using.
338361
339362
This bit can be set in *flags* to cause division operator ``/`` to be
340363
interpreted as "true division" according to :pep:`238`.
341-

Doc/data/refcounts.dat

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,12 @@ PyDict_GetItem:PyObject*:key:0:
218218

219219
PyDict_GetItemString:PyObject*::0:
220220
PyDict_GetItemString:PyObject*:p:0:
221-
PyDict_GetItemString:char*:key::
221+
PyDict_GetItemString:const char*:key::
222+
223+
PyDict_SetDefault:PyObject*::0:
224+
PyDict_SetDefault:PyObject*:p:0:
225+
PyDict_SetDefault:PyObject*:key:0:conditionally +1 if inserted into the dict
226+
PyDict_SetDefault:PyObject*:default:0:conditionally +1 if inserted into the dict
222227

223228
PyDict_Items:PyObject*::+1:
224229
PyDict_Items:PyObject*:p:0:
@@ -912,7 +917,7 @@ PyObject_Call:PyObject*:kw:0:
912917

913918
PyObject_CallFunction:PyObject*::+1:
914919
PyObject_CallFunction:PyObject*:callable_object:0:
915-
PyObject_CallFunction:char*:format::
920+
PyObject_CallFunction:const char*:format::
916921
PyObject_CallFunction::...::
917922

918923
PyObject_CallFunctionObjArgs:PyObject*::+1:
@@ -921,8 +926,8 @@ PyObject_CallFunctionObjArgs::...::
921926

922927
PyObject_CallMethod:PyObject*::+1:
923928
PyObject_CallMethod:PyObject*:o:0:
924-
PyObject_CallMethod:char*:m::
925-
PyObject_CallMethod:char*:format::
929+
PyObject_CallMethod:const char*:m::
930+
PyObject_CallMethod:const char*:format::
926931
PyObject_CallMethod::...::
927932

928933
PyObject_CallMethodObjArgs:PyObject*::+1:

Doc/extending/embedding.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,14 +285,14 @@ be directly useful to you:
285285
* ``pythonX.Y-config --cflags`` will give you the recommended flags when
286286
compiling::
287287

288-
$ /opt/bin/python3.3-config --cflags
289-
-I/opt/include/python3.3m -I/opt/include/python3.3m -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes
288+
$ /opt/bin/python3.4-config --cflags
289+
-I/opt/include/python3.4m -I/opt/include/python3.4m -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes
290290

291291
* ``pythonX.Y-config --ldflags`` will give you the recommended flags when
292292
linking::
293293

294-
$ /opt/bin/python3.3-config --ldflags
295-
-L/opt/lib/python3.3/config-3.3m -lpthread -ldl -lutil -lm -lpython3.3m -Xlinker -export-dynamic
294+
$ /opt/bin/python3.4-config --ldflags
295+
-L/opt/lib/python3.4/config-3.4m -lpthread -ldl -lutil -lm -lpython3.4m -Xlinker -export-dynamic
296296

297297
.. note::
298298
To avoid confusion between several Python installations (and especially

0 commit comments

Comments
 (0)