Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitefe465d

Browse files
authored
Merge branch 'main' into virtual-iterators
2 parents37ca285 +c81fa2b commitefe465d

File tree

78 files changed

+888
-678
lines changed

Some content is hidden

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

78 files changed

+888
-678
lines changed

‎Doc/c-api/import.rst

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,6 @@ Importing Modules
1616
This is a wrapper around :c:func:`PyImport_Import()` which takes a
1717
:c:expr:`const char *` as an argument instead of a :c:expr:`PyObject *`.
1818
19-
.. c:function:: PyObject* PyImport_ImportModuleNoBlock(const char *name)
20-
21-
This function is a deprecated alias of:c:func:`PyImport_ImportModule`.
22-
23-
..versionchanged::3.3
24-
This function used to fail immediately when the import lock was held
25-
by another thread. In Python 3.3 though, the locking scheme switched
26-
to per-module locks for most purposes, so this function's special
27-
behaviour isn't needed anymore.
28-
29-
..deprecated-removed::3.13 3.15
30-
Use:c:func:`PyImport_ImportModule` instead.
31-
3219
3320
.. c:function:: PyObject* PyImport_ImportModuleEx(const char *name, PyObject *globals, PyObject *locals, PyObject *fromlist)
3421

‎Doc/c-api/intro.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -826,14 +826,17 @@ frequently used builds will be described in the remainder of this section.
826826
827827
Compiling the interpreter with the:c:macro:`!Py_DEBUG` macro defined produces
828828
what is generally meant by:ref:`a debug build of Python<debug-build>`.
829-
:c:macro:`!Py_DEBUG` is enabled in the Unix build by adding
830-
:option:`--with-pydebug` to the:file:`./configure` command.
831-
It is also implied by the presence of the
832-
not-Python-specific:c:macro:`!_DEBUG` macro. When:c:macro:`!Py_DEBUG` is enabled
833-
in the Unix build, compiler optimization is disabled.
829+
830+
On Unix,:c:macro:`!Py_DEBUG` can be enabled by adding:option:`--with-pydebug`
831+
to the:file:`./configure` command. This will also disable compiler optimization.
832+
833+
On Windows, selecting a debug build (e.g., by passing the:option:`-d` option to
834+
:file:`PCbuild/build.bat`) automatically enables:c:macro:`!Py_DEBUG`.
835+
Additionally, the presence of the not-Python-specific:c:macro:`!_DEBUG` macro,
836+
when defined by the compiler, will also implicitly enable:c:macro:`!Py_DEBUG`.
834837

835838
In addition to the reference count debugging described below, extra checks are
836-
performed, see:ref:`Python Debug Build<debug-build>`.
839+
performed. See:ref:`Python Debug Build<debug-build>` for more details.
837840

838841
Defining:c:macro:`Py_TRACE_REFS` enables reference tracing
839842
(see the:option:`configure --with-trace-refs option <--with-trace-refs>`).

‎Doc/data/refcounts.dat

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,9 +1093,6 @@ PyImport_ImportModuleLevelObject:PyObject*:locals:0:???
10931093
PyImport_ImportModuleLevelObject:PyObject*:fromlist:0:???
10941094
PyImport_ImportModuleLevelObject:int:level::
10951095

1096-
PyImport_ImportModuleNoBlock:PyObject*::+1:
1097-
PyImport_ImportModuleNoBlock:const char*:name::
1098-
10991096
PyImport_ReloadModule:PyObject*::+1:
11001097
PyImport_ReloadModule:PyObject*:m:0:
11011098

‎Doc/data/stable_abi.dat

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎Doc/deprecations/c-api-pending-removal-in-3.15.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Pending removal in Python 3.15
22
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33

44
* The bundled copy of ``libmpdecimal``.
5-
* The:c:func:`PyImport_ImportModuleNoBlock`:
5+
* The:c:func:`!PyImport_ImportModuleNoBlock`:
66
Use:c:func:`PyImport_ImportModule` instead.
77
*:c:func:`PyWeakref_GetObject` and:c:func:`PyWeakref_GET_OBJECT`:
88
Use:c:func:`PyWeakref_GetRef` instead. The `pythoncapi-compat project

‎Doc/library/sqlite3.rst

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,10 @@ Reference
259259
Module functions
260260
^^^^^^^^^^^^^^^^
261261

262-
..function::connect(database, timeout=5.0, detect_types=0, \
262+
..function::connect(database,*,timeout=5.0, detect_types=0, \
263263
isolation_level="DEFERRED", check_same_thread=True, \
264264
factory=sqlite3.Connection, cached_statements=128, \
265-
uri=False,*,\
265+
uri=False, \
266266
autocommit=sqlite3.LEGACY_TRANSACTION_CONTROL)
267267

268268
Open a connection to an SQLite database.
@@ -355,11 +355,8 @@ Module functions
355355
..versionchanged::3.12
356356
Added the *autocommit* parameter.
357357

358-
..versionchanged::3.13
359-
Positional use of the parameters *timeout*, *detect_types*,
360-
*isolation_level*, *check_same_thread*, *factory*, *cached_statements*,
361-
and *uri* is deprecated.
362-
They will become keyword-only parameters in Python 3.15.
358+
..versionchanged::3.15
359+
All parameters except *database* are now keyword-only.
363360

364361
..function::complete_statement(statement)
365362

@@ -693,7 +690,7 @@ Connection objects
693690
:meth:`~Cursor.executescript` on it with the given *sql_script*.
694691
Return the new cursor object.
695692

696-
..method::create_function(name, narg, func, *, deterministic=False)
693+
..method::create_function(name, narg, func,/,*, deterministic=False)
697694

698695
Create or remove a user-defined SQL function.
699696

@@ -719,6 +716,9 @@ Connection objects
719716
..versionchanged::3.8
720717
Added the *deterministic* parameter.
721718

719+
..versionchanged::3.15
720+
The first three parameters are now positional-only.
721+
722722
Example:
723723

724724
..doctest::
@@ -733,13 +733,8 @@ Connection objects
733733
('acbd18db4cc2f85cedef654fccc4a4d8',)
734734
>>>con.close()
735735

736-
..versionchanged::3.13
737-
738-
Passing *name*, *narg*, and *func* as keyword arguments is deprecated.
739-
These parameters will become positional-only in Python 3.15.
740-
741736

742-
..method::create_aggregate(name, n_arg, aggregate_class)
737+
..method::create_aggregate(name, n_arg, aggregate_class, /)
743738

744739
Create or remove a user-defined SQL aggregate function.
745740

@@ -763,6 +758,9 @@ Connection objects
763758
Set to ``None`` to remove an existing SQL aggregate function.
764759
:type aggregate_class::term:`class` | None
765760

761+
..versionchanged::3.15
762+
All three parameters are now positional-only.
763+
766764
Example:
767765

768766
..testcode::
@@ -792,11 +790,6 @@ Connection objects
792790

793791
3
794792

795-
..versionchanged::3.13
796-
797-
Passing *name*, *n_arg*, and *aggregate_class* as keyword arguments is deprecated.
798-
These parameters will become positional-only in Python 3.15.
799-
800793

801794
..method::create_window_function(name, num_params, aggregate_class, /)
802795

@@ -937,7 +930,7 @@ Connection objects
937930
Aborted queries will raise an:exc:`OperationalError`.
938931

939932

940-
..method::set_authorizer(authorizer_callback)
933+
..method::set_authorizer(authorizer_callback, /)
941934

942935
Register:term:`callable` *authorizer_callback* to be invoked
943936
for each attempt to access a column of a table in the database.
@@ -962,12 +955,11 @@ Connection objects
962955
..versionchanged::3.11
963956
Added support for disabling the authorizer using ``None``.
964957

965-
..versionchanged::3.13
966-
Passing *authorizer_callback* as a keyword argument is deprecated.
967-
The parameter will become positional-only in Python 3.15.
958+
..versionchanged::3.15
959+
The only parameter is now positional-only.
968960

969961

970-
..method::set_progress_handler(progress_handler, n)
962+
..method::set_progress_handler(progress_handler,/,n)
971963

972964
Register:term:`callable` *progress_handler* to be invoked for every *n*
973965
instructions of the SQLite virtual machine. This is useful if you want to
@@ -981,12 +973,11 @@ Connection objects
981973
currently executing query and cause it to raise a:exc:`DatabaseError`
982974
exception.
983975

984-
..versionchanged::3.13
985-
Passing *progress_handler* as a keyword argument is deprecated.
986-
The parameter will become positional-only in Python 3.15.
976+
..versionchanged::3.15
977+
The first parameter is now positional-only.
987978

988979

989-
..method::set_trace_callback(trace_callback)
980+
..method::set_trace_callback(trace_callback, /)
990981

991982
Register:term:`callable` *trace_callback* to be invoked
992983
for each SQL statement that is actually executed by the SQLite backend.
@@ -1009,9 +1000,8 @@ Connection objects
10091000

10101001
..versionadded::3.3
10111002

1012-
..versionchanged::3.13
1013-
Passing *trace_callback* as a keyword argument is deprecated.
1014-
The parameter will become positional-only in Python 3.15.
1003+
..versionchanged::3.15
1004+
The first parameter is now positional-only.
10151005

10161006

10171007
..method::enable_load_extension(enabled, /)

‎Doc/reference/lexical_analysis.rst

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ Logical lines
3535

3636
..index::logical line, physical line, line joining, NEWLINE token
3737

38-
The end of a logical line is represented by the token NEWLINE. Statements
39-
cannot cross logical line boundaries except where NEWLINE is allowed by the
40-
syntax (e.g., between statements in compound statements). A logical line is
41-
constructed from one or more *physical lines* by following the explicit or
42-
implicit *line joining* rules.
38+
The end of a logical line is represented by the token:data:`~token.NEWLINE`.
39+
Statementscannot cross logical line boundaries except where:data:`!NEWLINE`
40+
is allowed by thesyntax (e.g., between statements in compound statements).
41+
A logical line isconstructed from one or more *physical lines* by following
42+
the explicit orimplicit *line joining* rules.
4343

4444

4545
.. _physical-lines:
@@ -160,11 +160,12 @@ Blank lines
160160
..index::single: blank line
161161

162162
A logical line that contains only spaces, tabs, formfeeds and possibly a
163-
comment, is ignored (i.e., no NEWLINE token is generated). During interactive
164-
input of statements, handling of a blank line may differ depending on the
165-
implementation of the read-eval-print loop. In the standard interactive
166-
interpreter, an entirely blank logical line (i.e. one containing not even
167-
whitespace or a comment) terminates a multi-line statement.
163+
comment, is ignored (i.e., no:data:`~token.NEWLINE` token is generated).
164+
During interactive input of statements, handling of a blank line may differ
165+
depending on the implementation of the read-eval-print loop.
166+
In the standard interactive interpreter, an entirely blank logical line (that
167+
is, one containing not even whitespace or a comment) terminates a multi-line
168+
statement.
168169

169170

170171
.. _indentation:
@@ -202,19 +203,20 @@ the space count to zero).
202203

203204
..index::INDENT token, DEDENT token
204205

205-
The indentation levels of consecutive lines are used to generate INDENT and
206-
DEDENT tokens, using a stack, as follows.
206+
The indentation levels of consecutive lines are used to generate
207+
:data:`~token.INDENT` and:data:`~token.DEDENT` tokens, using a stack,
208+
as follows.
207209

208210
Before the first line of the file is read, a single zero is pushed on the stack;
209211
this will never be popped off again. The numbers pushed on the stack will
210212
always be strictly increasing from bottom to top. At the beginning of each
211213
logical line, the line's indentation level is compared to the top of the stack.
212214
If it is equal, nothing happens. If it is larger, it is pushed on the stack, and
213-
one INDENT token is generated. If it is smaller, it *must* be one of the
215+
one:data:`!INDENT` token is generated. If it is smaller, it *must* be one of the
214216
numbers occurring on the stack; all numbers on the stack that are larger are
215-
popped off, and for each number popped off a DEDENT token is generated. At the
216-
end of the file, a DEDENT token is generated for each number remaining on the
217-
stack that is larger than zero.
217+
popped off, and for each number popped off a:data:`!DEDENT` token is generated.
218+
At theend of the file, a:data:`!DEDENT` token is generated for each number
219+
remaining on thestack that is larger than zero.
218220

219221
Here is an example of a correctly (though confusingly) indented piece of Python
220222
code::
@@ -254,20 +256,34 @@ Whitespace between tokens
254256
Except at the beginning of a logical line or in string literals, the whitespace
255257
characters space, tab and formfeed can be used interchangeably to separate
256258
tokens. Whitespace is needed between two tokens only if their concatenation
257-
could otherwise be interpreted as a different token (e.g., ab is one token, but
258-
a b is two tokens).
259+
could otherwise be interpreted as a different token. For example, ``ab`` is one
260+
token, but ``a b`` is two tokens. However, ``+a`` and ``+ a`` both produce
261+
two tokens, ``+`` and ``a``, as ``+a`` is not a valid token.
262+
263+
264+
.. _endmarker-token:
265+
266+
End marker
267+
----------
268+
269+
At the end of non-interactive input, the lexical analyzer generates an
270+
:data:`~token.ENDMARKER` token.
259271

260272

261273
.. _other-tokens:
262274

263275
Other tokens
264276
============
265277

266-
Besides NEWLINE, INDENT and DEDENT, the following categories of tokens exist:
267-
*identifiers*, *keywords*, *literals*, *operators*, and *delimiters*. Whitespace
268-
characters (other than line terminators, discussed earlier) are not tokens, but
269-
serve to delimit tokens. Where ambiguity exists, a token comprises the longest
270-
possible string that forms a legal token, when read from left to right.
278+
Besides:data:`~token.NEWLINE`,:data:`~token.INDENT` and:data:`~token.DEDENT`,
279+
the following categories of tokens exist:
280+
*identifiers* and *keywords* (:data:`~token.NAME`), *literals* (such as
281+
:data:`~token.NUMBER` and:data:`~token.STRING`), and other symbols
282+
(*operators* and *delimiters*,:data:`~token.OP`).
283+
Whitespace characters (other than logical line terminators, discussed earlier)
284+
are not tokens, but serve to delimit tokens.
285+
Where ambiguity exists, a token comprises the longest possible string that
286+
forms a legal token, when read from left to right.
271287

272288

273289
.. _identifiers:

‎Doc/tutorial/introduction.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ Python can manipulate text (represented by type :class:`str`, so-called
147147
"``Yay! :)``". They can be enclosed in single quotes (``'...'``) or double
148148
quotes (``"..."``) with the same result [#]_.
149149

150+
..code-block::pycon
151+
150152
>>> 'spam eggs' # single quotes
151153
'spam eggs'
152154
>>> "Paris rabbit got your back :)! Yay!" # double quotes

‎Doc/whatsnew/2.6.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3043,7 +3043,7 @@ Changes to Python's build process and to the C API include:
30433043

30443044
* Importing modules simultaneously in two different threads no longer
30453045
deadlocks; it will now raise an:exc:`ImportError`. A new API
3046-
function,:c:func:`PyImport_ImportModuleNoBlock`, will look for a
3046+
function,:c:func:`!PyImport_ImportModuleNoBlock`, will look for a
30473047
module in ``sys.modules`` first, then try to import it after
30483048
acquiring an import lock. If the import lock is held by another
30493049
thread, an:exc:`ImportError` is raised.

‎Doc/whatsnew/3.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ to the C API.
870870
*:c:func:`!PyNumber_Coerce`,:c:func:`!PyNumber_CoerceEx`,
871871
:c:func:`!PyMember_Get`, and:c:func:`!PyMember_Set` C APIs are removed.
872872

873-
* New C API:c:func:`PyImport_ImportModuleNoBlock`, works like
873+
* New C API:c:func:`!PyImport_ImportModuleNoBlock`, works like
874874
:c:func:`PyImport_ImportModule` but won't block on the import lock
875875
(returning an error instead).
876876

‎Doc/whatsnew/3.13.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2499,7 +2499,7 @@ Deprecated C APIs
24992499
which return a:term:`borrowed reference`.
25002500
(Soft deprecated as part of:pep:`667`.)
25012501

2502-
* Deprecate the:c:func:`PyImport_ImportModuleNoBlock` function,
2502+
* Deprecate the:c:func:`!PyImport_ImportModuleNoBlock` function,
25032503
which is just an alias to:c:func:`PyImport_ImportModule` since Python 3.3.
25042504
(Contributed by Victor Stinner in:gh:`105396`.)
25052505

‎Doc/whatsnew/3.15.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,16 @@ New features
143143
Porting to Python 3.15
144144
----------------------
145145

146-
* TODO
146+
*:class:`sqlite3.Connection` APIs has been cleaned up.
147+
148+
* All parameters of:func:`sqlite3.connect` except *database* are now keyword-only.
149+
* The first three parameters of methods:meth:`~sqlite3.Connection.create_function`
150+
and:meth:`~sqlite3.Connection.create_aggregate` are now positional-only.
151+
* The first parameter of methods:meth:`~sqlite3.Connection.set_authorizer`,
152+
:meth:`~sqlite3.Connection.set_progress_handler` and
153+
:meth:`~sqlite3.Connection.set_trace_callback` is now positional-only.
154+
155+
(Contributed by Serhiy Storchaka in:gh:`133595`.)
147156

148157
Deprecated C APIs
149158
-----------------
@@ -155,3 +164,5 @@ Deprecated C APIs
155164
Removed C APIs
156165
--------------
157166

167+
*:c:func:`!PyImport_ImportModuleNoBlock`: deprecated alias
168+
of:c:func:`PyImport_ImportModule`.

‎Doc/whatsnew/3.3.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ Previous versions of CPython have always relied on a global import lock.
829829
This led to unexpected annoyances, such as deadlocks when importing a module
830830
would trigger code execution in a different thread as a side-effect.
831831
Clumsy workarounds were sometimes employed, such as the
832-
:c:func:`PyImport_ImportModuleNoBlock` C API function.
832+
:c:func:`!PyImport_ImportModuleNoBlock` C API function.
833833

834834
In Python 3.3, importing a module takes a per-module lock. This correctly
835835
serializes importation of a given module from multiple threads (preventing

‎Include/import.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ PyAPI_FUNC(PyObject *) PyImport_AddModuleRef(
5151
PyAPI_FUNC(PyObject*)PyImport_ImportModule(
5252
constchar*name/* UTF-8 encoded string */
5353
);
54-
Py_DEPRECATED(3.13)PyAPI_FUNC(PyObject*)PyImport_ImportModuleNoBlock(
55-
constchar*name/* UTF-8 encoded string */
56-
);
5754
PyAPI_FUNC(PyObject*)PyImport_ImportModuleLevel(
5855
constchar*name,/* UTF-8 encoded string */
5956
PyObject*globals,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp