Skip to content

Commit 37d2e20

Browse files
committed
Merge branch 'main' into pythongh-81079-glob-case-sensitive-arg-2
2 parents 203e734 + da1980a commit 37d2e20

File tree

98 files changed

+4110
-4409
lines changed

Some content is hidden

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

98 files changed

+4110
-4409
lines changed

Doc/c-api/import.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@ Importing Modules
186186
187187
.. versionadded:: 3.2
188188
.. versionchanged:: 3.3
189-
Uses :func:`imp.source_from_cache()` in calculating the source path if
189+
Uses :func:`!imp.source_from_cache()` in calculating the source path if
190190
only the bytecode path is provided.
191191
.. versionchanged:: 3.12
192-
No longer uses the removed ``imp`` module.
192+
No longer uses the removed :mod:`!imp` module.
193193
194194
195195
.. c:function:: long PyImport_GetMagicNumber()

Doc/c-api/type.rst

+24-2
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,13 @@ The following functions and structs are used to create
256256
The metaclass *metaclass* is used to construct the resulting type object.
257257
When *metaclass* is ``NULL``, the metaclass is derived from *bases*
258258
(or *Py_tp_base[s]* slots if *bases* is ``NULL``, see below).
259-
Note that metaclasses that override
260-
:c:member:`~PyTypeObject.tp_new` are not supported.
259+
260+
Metaclasses that override :c:member:`~PyTypeObject.tp_new` are not
261+
supported.
262+
(For backwards compatibility, other ``PyType_From*`` functions allow
263+
such metaclasses. They ignore ``tp_new``, which may result in incomplete
264+
initialization. This is deprecated and in Python 3.14+ such metaclasses will
265+
not be supported.)
261266
262267
The *bases* argument can be used to specify base classes; it can either
263268
be only one class or a tuple of classes.
@@ -305,6 +310,11 @@ The following functions and structs are used to create
305310
The function now finds and uses a metaclass corresponding to the provided
306311
base classes. Previously, only :class:`type` instances were returned.
307312
313+
The :c:member:`~PyTypeObject.tp_new` of the metaclass is *ignored*.
314+
which may result in incomplete initialization.
315+
Creating classes whose metaclass overrides
316+
:c:member:`~PyTypeObject.tp_new` is deprecated and in Python 3.14+ it
317+
will be no longer allowed.
308318
309319
.. c:function:: PyObject* PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases)
310320
@@ -317,6 +327,12 @@ The following functions and structs are used to create
317327
The function now finds and uses a metaclass corresponding to the provided
318328
base classes. Previously, only :class:`type` instances were returned.
319329
330+
The :c:member:`~PyTypeObject.tp_new` of the metaclass is *ignored*.
331+
which may result in incomplete initialization.
332+
Creating classes whose metaclass overrides
333+
:c:member:`~PyTypeObject.tp_new` is deprecated and in Python 3.14+ it
334+
will be no longer allowed.
335+
320336
.. c:function:: PyObject* PyType_FromSpec(PyType_Spec *spec)
321337
322338
Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``.
@@ -327,6 +343,12 @@ The following functions and structs are used to create
327343
base classes provided in *Py_tp_base[s]* slots.
328344
Previously, only :class:`type` instances were returned.
329345
346+
The :c:member:`~PyTypeObject.tp_new` of the metaclass is *ignored*.
347+
which may result in incomplete initialization.
348+
Creating classes whose metaclass overrides
349+
:c:member:`~PyTypeObject.tp_new` is deprecated and in Python 3.14+ it
350+
will be no longer allowed.
351+
330352
.. c:type:: PyType_Spec
331353
332354
Structure defining a type's behavior.

Doc/howto/curses.rst

+23-21
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
Curses Programming with Python
55
**********************************
66

7+
.. currentmodule:: curses
8+
79
:Author: A.M. Kuchling, Eric S. Raymond
810
:Release: 2.04
911

@@ -65,7 +67,7 @@ The Python module is a fairly simple wrapper over the C functions provided by
6567
curses; if you're already familiar with curses programming in C, it's really
6668
easy to transfer that knowledge to Python. The biggest difference is that the
6769
Python interface makes things simpler by merging different C functions such as
68-
:c:func:`addstr`, :c:func:`mvaddstr`, and :c:func:`mvwaddstr` into a single
70+
:c:func:`!addstr`, :c:func:`!mvaddstr`, and :c:func:`!mvwaddstr` into a single
6971
:meth:`~curses.window.addstr` method. You'll see this covered in more
7072
detail later.
7173

@@ -82,7 +84,7 @@ Before doing anything, curses must be initialized. This is done by
8284
calling the :func:`~curses.initscr` function, which will determine the
8385
terminal type, send any required setup codes to the terminal, and
8486
create various internal data structures. If successful,
85-
:func:`initscr` returns a window object representing the entire
87+
:func:`!initscr` returns a window object representing the entire
8688
screen; this is usually called ``stdscr`` after the name of the
8789
corresponding C variable. ::
8890

@@ -151,8 +153,8 @@ importing the :func:`curses.wrapper` function and using it like this::
151153

152154
The :func:`~curses.wrapper` function takes a callable object and does the
153155
initializations described above, also initializing colors if color
154-
support is present. :func:`wrapper` then runs your provided callable.
155-
Once the callable returns, :func:`wrapper` will restore the original
156+
support is present. :func:`!wrapper` then runs your provided callable.
157+
Once the callable returns, :func:`!wrapper` will restore the original
156158
state of the terminal. The callable is called inside a
157159
:keyword:`try`...\ :keyword:`except` that catches exceptions, restores
158160
the state of the terminal, and then re-raises the exception. Therefore
@@ -200,7 +202,7 @@ This is because curses was originally written with slow 300-baud
200202
terminal connections in mind; with these terminals, minimizing the
201203
time required to redraw the screen was very important. Instead curses
202204
accumulates changes to the screen and displays them in the most
203-
efficient manner when you call :meth:`refresh`. For example, if your
205+
efficient manner when you call :meth:`!refresh`. For example, if your
204206
program displays some text in a window and then clears the window,
205207
there's no need to send the original text because they're never
206208
visible.
@@ -210,7 +212,7 @@ really complicate programming with curses much. Most programs go into a flurry
210212
of activity, and then pause waiting for a keypress or some other action on the
211213
part of the user. All you have to do is to be sure that the screen has been
212214
redrawn before pausing to wait for user input, by first calling
213-
``stdscr.refresh()`` or the :meth:`refresh` method of some other relevant
215+
:meth:`!stdscr.refresh` or the :meth:`!refresh` method of some other relevant
214216
window.
215217

216218
A pad is a special case of a window; it can be larger than the actual display
@@ -234,15 +236,15 @@ displayed. ::
234236
# : filled with pad content.
235237
pad.refresh( 0,0, 5,5, 20,75)
236238

237-
The :meth:`refresh` call displays a section of the pad in the rectangle
239+
The :meth:`!refresh` call displays a section of the pad in the rectangle
238240
extending from coordinate (5,5) to coordinate (20,75) on the screen; the upper
239241
left corner of the displayed section is coordinate (0,0) on the pad. Beyond
240242
that difference, pads are exactly like ordinary windows and support the same
241243
methods.
242244

243245
If you have multiple windows and pads on screen there is a more
244246
efficient way to update the screen and prevent annoying screen flicker
245-
as each part of the screen gets updated. :meth:`refresh` actually
247+
as each part of the screen gets updated. :meth:`!refresh` actually
246248
does two things:
247249

248250
1) Calls the :meth:`~curses.window.noutrefresh` method of each window
@@ -251,8 +253,8 @@ does two things:
251253
2) Calls the function :func:`~curses.doupdate` function to change the
252254
physical screen to match the desired state recorded in the data structure.
253255

254-
Instead you can call :meth:`noutrefresh` on a number of windows to
255-
update the data structure, and then call :func:`doupdate` to update
256+
Instead you can call :meth:`!noutrefresh` on a number of windows to
257+
update the data structure, and then call :func:`!doupdate` to update
256258
the screen.
257259

258260

@@ -261,11 +263,11 @@ Displaying Text
261263

262264
From a C programmer's point of view, curses may sometimes look like a
263265
twisty maze of functions, all subtly different. For example,
264-
:c:func:`addstr` displays a string at the current cursor location in
265-
the ``stdscr`` window, while :c:func:`mvaddstr` moves to a given y,x
266-
coordinate first before displaying the string. :c:func:`waddstr` is just
267-
like :c:func:`addstr`, but allows specifying a window to use instead of
268-
using ``stdscr`` by default. :c:func:`mvwaddstr` allows specifying both
266+
:c:func:`!addstr` displays a string at the current cursor location in
267+
the ``stdscr`` window, while :c:func:`!mvaddstr` moves to a given y,x
268+
coordinate first before displaying the string. :c:func:`!waddstr` is just
269+
like :c:func:`!addstr`, but allows specifying a window to use instead of
270+
using ``stdscr`` by default. :c:func:`!mvwaddstr` allows specifying both
269271
a window and a coordinate.
270272

271273
Fortunately the Python interface hides all these details. ``stdscr``
@@ -298,7 +300,7 @@ the next subsection.
298300
The :meth:`~curses.window.addstr` method takes a Python string or
299301
bytestring as the value to be displayed. The contents of bytestrings
300302
are sent to the terminal as-is. Strings are encoded to bytes using
301-
the value of the window's :attr:`encoding` attribute; this defaults to
303+
the value of the window's :attr:`~window.encoding` attribute; this defaults to
302304
the default system encoding as returned by :func:`locale.getencoding`.
303305

304306
The :meth:`~curses.window.addch` methods take a character, which can be
@@ -444,15 +446,15 @@ There are two methods for getting input from a window:
444446

445447
It's possible to not wait for the user using the
446448
:meth:`~curses.window.nodelay` window method. After ``nodelay(True)``,
447-
:meth:`getch` and :meth:`getkey` for the window become
448-
non-blocking. To signal that no input is ready, :meth:`getch` returns
449-
``curses.ERR`` (a value of -1) and :meth:`getkey` raises an exception.
449+
:meth:`!getch` and :meth:`!getkey` for the window become
450+
non-blocking. To signal that no input is ready, :meth:`!getch` returns
451+
``curses.ERR`` (a value of -1) and :meth:`!getkey` raises an exception.
450452
There's also a :func:`~curses.halfdelay` function, which can be used to (in
451-
effect) set a timer on each :meth:`getch`; if no input becomes
453+
effect) set a timer on each :meth:`!getch`; if no input becomes
452454
available within a specified delay (measured in tenths of a second),
453455
curses raises an exception.
454456

455-
The :meth:`getch` method returns an integer; if it's between 0 and 255, it
457+
The :meth:`!getch` method returns an integer; if it's between 0 and 255, it
456458
represents the ASCII code of the key pressed. Values greater than 255 are
457459
special keys such as Page Up, Home, or the cursor keys. You can compare the
458460
value returned to constants such as :const:`curses.KEY_PPAGE`,

0 commit comments

Comments
 (0)