Skip to content

Commit 7f6b8b8

Browse files
authored
Merge branch 'main' into patch-4
2 parents 1678928 + 2b563f1 commit 7f6b8b8

File tree

430 files changed

+6973
-3553
lines changed

Some content is hidden

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

430 files changed

+6973
-3553
lines changed

.github/dependabot.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ updates:
77
labels:
88
- "skip issue"
99
- "skip news"
10+
ignore:
11+
- dependency-name: "*"
12+
update-types:
13+
- "version-update:semver-minor"
14+
- "version-update:semver-patch"

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ jobs:
185185
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
186186
- name: 'Restore OpenSSL build'
187187
id: cache-openssl
188-
uses: actions/cache@v3.0.1
188+
uses: actions/cache@v3
189189
with:
190190
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
191191
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
@@ -248,7 +248,7 @@ jobs:
248248
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
249249
- name: 'Restore OpenSSL build'
250250
id: cache-openssl
251-
uses: actions/cache@v3.0.1
251+
uses: actions/cache@v3
252252
with:
253253
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
254254
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
@@ -292,7 +292,7 @@ jobs:
292292
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
293293
- name: 'Restore OpenSSL build'
294294
id: cache-openssl
295-
uses: actions/cache@v3.0.1
295+
uses: actions/cache@v3
296296
with:
297297
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
298298
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}

.github/workflows/new-bugs-announce-notifier.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ jobs:
99
notify-new-bugs-announce:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/setup-node@v2
12+
- uses: actions/setup-node@v3
1313
with:
1414
node-version: 14
1515
- run: npm install mailgun.js form-data
1616
- name: Send notification
17-
uses: actions/github-script@v5
17+
uses: actions/github-script@v6
1818
env:
1919
MAILGUN_API_KEY: ${{ secrets.PSF_MAILGUN_KEY }}
2020
with:

.github/workflows/stale.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
steps:
1717
- name: "Check PRs"
18-
uses: actions/stale@v4
18+
uses: actions/stale@v5
1919
with:
2020
repo-token: ${{ secrets.GITHUB_TOKEN }}
2121
stale-pr-message: 'This PR is stale because it has been open for 30 days with no activity.'

Doc/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Contributing
130130
============
131131

132132
Bugs in the content should be reported to the
133-
`Python bug tracker <https://bugs.python.org>`_.
133+
`Python bug tracker <https://github.com/python/cpython/issues>`_.
134134

135135
Bugs in the toolset should be reported to the tools themselves.
136136

Doc/c-api/bytearray.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ These macros trade safety for speed and they don't check pointers.
7777
7878
.. c:function:: char* PyByteArray_AS_STRING(PyObject *bytearray)
7979
80-
Macro version of :c:func:`PyByteArray_AsString`.
80+
Similar to :c:func:`PyByteArray_AsString`, but without error checking.
8181
8282
8383
.. c:function:: Py_ssize_t PyByteArray_GET_SIZE(PyObject *bytearray)
8484
85-
Macro version of :c:func:`PyByteArray_Size`.
85+
Similar to :c:func:`PyByteArray_Size`, but without error checking.

Doc/c-api/bytes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ called with a non-bytes parameter.
134134
135135
.. c:function:: Py_ssize_t PyBytes_GET_SIZE(PyObject *o)
136136
137-
Macro form of :c:func:`PyBytes_Size` but without error checking.
137+
Similar to :c:func:`PyBytes_Size`, but without error checking.
138138
139139
140140
.. c:function:: char* PyBytes_AsString(PyObject *o)
@@ -151,7 +151,7 @@ called with a non-bytes parameter.
151151
152152
.. c:function:: char* PyBytes_AS_STRING(PyObject *string)
153153
154-
Macro form of :c:func:`PyBytes_AsString` but without error checking.
154+
Similar to :c:func:`PyBytes_AsString`, but without error checking.
155155
156156
157157
.. c:function:: int PyBytes_AsStringAndSize(PyObject *obj, char **buffer, Py_ssize_t *length)

Doc/c-api/code.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,17 @@ bound into a function.
7676
information is not available for any particular element.
7777
7878
Returns ``1`` if the function succeeds and 0 otherwise.
79+
80+
.. c:function:: PyObject* PyCode_GetCode(PyCodeObject *co)
81+
82+
Equivalent to the Python code ``getattr(co, 'co_code')``.
83+
Returns a strong reference to a :c:type:`PyBytesObject` representing the
84+
bytecode in a code object. On error, ``NULL`` is returned and an exception
85+
is raised.
86+
87+
This ``PyBytesObject`` may be created on-demand by the interpreter and does
88+
not necessarily represent the bytecode actually executed by CPython. The
89+
primary use case for this function is debuggers and profilers.
90+
91+
.. versionadded:: 3.11
92+

Doc/c-api/init.rst

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,11 +549,11 @@ Process-wide parameters
549549
.. index:: single: version (in module sys)
550550
551551
The first word (up to the first space character) is the current Python version;
552-
the first three characters are the major and minor version separated by a
552+
the first characters are the major and minor version separated by a
553553
period. The returned string points into static storage; the caller should not
554554
modify its value. The value is available to Python code as :data:`sys.version`.
555555
556-
See also the :data:`Py_Version` constant.
556+
See also the :c:var:`Py_Version` constant.
557557
558558
559559
.. c:function:: const char* Py_GetPlatform()
@@ -616,6 +616,11 @@ Process-wide parameters
616616
single: Py_FatalError()
617617
single: argv (in module sys)
618618
619+
This API is kept for backward compatibility: setting
620+
:c:member:`PyConfig.argv`, :c:member:`PyConfig.parse_argv` and
621+
:c:member:`PyConfig.safe_path` should be used instead, see :ref:`Python
622+
Initialization Configuration <init-config>`.
623+
619624
Set :data:`sys.argv` based on *argc* and *argv*. These parameters are
620625
similar to those passed to the program's :c:func:`main` function with the
621626
difference that the first entry should refer to the script file to be
@@ -659,9 +664,15 @@ Process-wide parameters
659664
.. XXX impl. doesn't seem consistent in allowing ``0``/``NULL`` for the params;
660665
check w/ Guido.
661666
667+
.. deprecated:: 3.11
668+
662669

663670
.. c:function:: void PySys_SetArgv(int argc, wchar_t **argv)
664671
672+
This API is kept for backward compatibility: setting
673+
:c:member:`PyConfig.argv` and :c:member:`PyConfig.parse_argv` should be used
674+
instead, see :ref:`Python Initialization Configuration <init-config>`.
675+
665676
This function works like :c:func:`PySys_SetArgvEx` with *updatepath* set
666677
to ``1`` unless the :program:`python` interpreter was started with the
667678
:option:`-I`.
@@ -674,6 +685,8 @@ Process-wide parameters
674685
675686
.. versionchanged:: 3.4 The *updatepath* value depends on :option:`-I`.
676687
688+
.. deprecated:: 3.11
689+
677690
678691
.. c:function:: void Py_SetPythonHome(const wchar_t *home)
679692

Doc/c-api/init_config.rst

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,25 @@ PyConfig
543543
544544
See also the :c:member:`~PyConfig.orig_argv` member.
545545
546+
.. c:member:: int safe_path
547+
548+
If equals to zero, ``Py_RunMain()`` prepends a potentially unsafe path to
549+
:data:`sys.path` at startup:
550+
551+
* If :c:member:`argv[0] <PyConfig.argv>` is equal to ``L"-m"``
552+
(``python -m module``), prepend the current working directory.
553+
* If running a script (``python script.py``), prepend the script's
554+
directory. If it's a symbolic link, resolve symbolic links.
555+
* Otherwise (``python -c code`` and ``python``), prepend an empty string,
556+
which means the current working directory.
557+
558+
Set to 1 by the :option:`-P` command line option and the
559+
:envvar:`PYTHONSAFEPATH` environment variable.
560+
561+
Default: ``0`` in Python config, ``1`` in isolated config.
562+
563+
.. versionadded:: 3.11
564+
546565
.. c:member:: wchar_t* base_exec_prefix
547566
548567
:data:`sys.base_exec_prefix`.
@@ -809,13 +828,14 @@ PyConfig
809828
810829
If greater than 0, enable isolated mode:
811830
812-
* :data:`sys.path` contains neither the script's directory (computed from
813-
``argv[0]`` or the current directory) nor the user's site-packages
814-
directory.
831+
* Set :c:member:`~PyConfig.safe_path` to 1:
832+
don't prepend a potentially unsafe path to :data:`sys.path` at Python
833+
startup.
834+
* Set :c:member:`~PyConfig.use_environment` to 0.
835+
* Set :c:member:`~PyConfig.user_site_directory` to 0: don't add the user
836+
site directory to :data:`sys.path`.
815837
* Python REPL doesn't import :mod:`readline` nor enable default readline
816838
configuration on interactive prompts.
817-
* Set :c:member:`~PyConfig.use_environment` and
818-
:c:member:`~PyConfig.user_site_directory` to 0.
819839
820840
Default: ``0`` in Python mode, ``1`` in isolated mode.
821841
@@ -1029,12 +1049,13 @@ PyConfig
10291049
.. c:member:: wchar_t* run_filename
10301050
10311051
Filename passed on the command line: trailing command line argument
1032-
without :option:`-c` or :option:`-m`.
1052+
without :option:`-c` or :option:`-m`. It is used by the
1053+
:c:func:`Py_RunMain` function.
10331054
10341055
For example, it is set to ``script.py`` by the ``python3 script.py arg``
1035-
command.
1056+
command line.
10361057
1037-
Used by :c:func:`Py_RunMain`.
1058+
See also the :c:member:`PyConfig.skip_source_first_line` option.
10381059
10391060
Default: ``NULL``.
10401061
@@ -1419,9 +1440,16 @@ site-package directory to :data:`sys.path`.
14191440
The following configuration files are used by the path configuration:
14201441
14211442
* ``pyvenv.cfg``
1422-
* ``python._pth`` (Windows only)
1443+
* ``._pth`` file (ex: ``python._pth``)
14231444
* ``pybuilddir.txt`` (Unix only)
14241445
1446+
If a ``._pth`` file is present:
1447+
1448+
* Set :c:member:`~PyConfig.isolated` to 1.
1449+
* Set :c:member:`~PyConfig.use_environment` to 0.
1450+
* Set :c:member:`~PyConfig.site_import` to 0.
1451+
* Set :c:member:`~PyConfig.safe_path` to 1.
1452+
14251453
The ``__PYVENV_LAUNCHER__`` environment variable is used to set
14261454
:c:member:`PyConfig.base_executable`
14271455

0 commit comments

Comments
 (0)