Skip to content

gh-119127: functools.partial placeholders #119303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 119 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
ee7333c
Initial Implementation
dg-pb May 21, 2024
8bcc462
serialization fix
dg-pb May 21, 2024
c67c9b4
bug fix
dg-pb May 21, 2024
680d900
Bug 2 fix
dg-pb May 21, 2024
9591ff5
Py_TPFLAGS_IMMUTABLETYPE added
dg-pb May 21, 2024
067e938
placeholder added to state as opposed to being used as global constant
dg-pb May 23, 2024
8af20b3
static removed
dg-pb May 23, 2024
607a0b1
creating sentinel via PyType_Spec
dg-pb May 23, 2024
f55801e
more accurate variable name
dg-pb May 23, 2024
5894145
trailing trim bug and tests
dg-pb May 24, 2024
3722e07
Updated docs
dg-pb May 24, 2024
a79c2af
blurb
dg-pb May 24, 2024
12aaa72
Merge branch 'main' into implement-119127
May 24, 2024
92c767b
minor edit
dg-pb May 24, 2024
496a9d2
doc fix
dg-pb May 24, 2024
84be524
gh-119180: Update the magic number (#119397)
JelleZijlstra May 25, 2024
de19694
gh-119105: Differ.compare is too slow [for degenerate cases] (#119492)
tim-one May 25, 2024
08e6543
gh-111999: Fix the signature of str.format_map() (#119540)
serhiy-storchaka May 25, 2024
a531fd7
FAQ: Add reference to Python version numbering scheme (#119225)
hugovk May 25, 2024
e3bac04
gh-119548: Add a 'clear' command to the REPL (#119549)
pablogsal May 25, 2024
6b6c1a9
Add codeowners for PYREPL (#119550)
pablogsal May 25, 2024
4b7eb32
gh-99180: Make `StackSummary.should_show_carets` private (#119554)
AlexWaygood May 25, 2024
0c5ebe1
gh-119560: Drop an Invalid Assert in PyState_FindModule() (gh-119561)
ericsnowcurrently May 25, 2024
e418fc3
GH-82805: Fix handling of single-dot file extensions in pathlib (#118…
barneygale May 25, 2024
d25954d
docs: fix a few typos identified by codespell (#119516)
nedbat May 26, 2024
b5b7dc9
Update README and layout.html from 3.13 to 3.14 (#119539)
Wulian233 May 26, 2024
008bc04
gh-119562: Remove AST nodes deprecated since Python 3.8 (#119563)
AlexWaygood May 26, 2024
70b07aa
gh-111997: Fix argument count for LINE event and clarify type of argu…
scoder May 26, 2024
0220663
gh-119562: Remove unused private string constants from `ast.py` (#119…
AlexWaygood May 26, 2024
5d04cc5
gh-102864: Add switching frame test for pdb (#119564)
gaogaotiantian May 26, 2024
5482a93
Re-order imports to align with zipp 3.18.2 (#119587)
jaraco May 27, 2024
5ef5622
Fix typos in HISTORY documentation (#119453)
xyb May 27, 2024
c7a5e1e
``Include/internal/pycore_import.h``: Fix typo (#119586)
Eclips4 May 27, 2024
3b26cd8
gh-119467: Fix Py_buffer.format type and correct documentation typo (…
adiaholic May 27, 2024
041a566
GH-117283: Add doc warning for `PyTuple_SetItem` refcount > 1 (#117916)
savannahostrowski May 27, 2024
59630f9
Docs: Add class role for IPV{4,6}Address and fix a typo (#118059)
rffontenelle May 27, 2024
88e3fee
Docs: Only install sphinx-autobuild for `make htmllive` (#119607)
hugovk May 27, 2024
3dfa364
gh-119580: Improve version added section for convenience variable (#1…
gaogaotiantian May 27, 2024
eea26c4
Docs: Move inline JavaScript to own file to reduce duplication (#119541)
hugovk May 27, 2024
3ff06eb
Withdraw most of my ownership in favor of Mark (#119611)
gvanrossum May 27, 2024
0bd0d40
Misc cleanups and wording improvements for the itertools docs (gh-119…
rhettinger May 27, 2024
ae7b176
gh-119584: Fix test_import Failed Assertion (gh-119623)
ericsnowcurrently May 27, 2024
3e8b609
gh-117398: Add multiphase support to _datetime (gh-119373)
erlend-aasland May 27, 2024
a9a74da
gh-119311: Fix name mangling with PEP 695 generic classes (#119464)
JelleZijlstra May 28, 2024
bf08f0a
Fix typos in comments (#119645)
xyb May 28, 2024
b313cc6
gh-117557: Improve error messages when a string, bytes or bytearray o…
serhiy-storchaka May 28, 2024
669175b
gh-116860: Remove outdated `test_parserhack` from `test_future` (#116…
sobolevn May 28, 2024
b407ad3
[doc] Clarify the nature of the root logger in the `logging` document…
jkunimune May 28, 2024
f912e5a
gh-118824: Remove deprecated `master_open` and `slave_open` from `pty…
sobolevn May 28, 2024
2da0dc0
gh-119659: Move `@no_rerun` to `test.support` (#119660)
sobolevn May 28, 2024
0518edc
gh-119396: Optimize unicode_repr() (#119617)
vstinner May 28, 2024
6ec3712
gh-119581: Add a test of InitVar with name shadowing (#119582)
stroxler May 28, 2024
a89fc26
gh-117398: gh-119655: datetime: Init static state once & don't free i…
encukou May 28, 2024
ae11d68
gh-117865: Defer import of re in ast (#119546)
JelleZijlstra May 28, 2024
6b240c2
gh-119011: `type.__type_params__` now return an empty tuple (#119296)
sobolevn May 28, 2024
ae9140f
gh-119676: remove several pseudo instructions which are use only in c…
iritkatriel May 28, 2024
d87b015
gh-119118: Fix performance regression in tokenize module (#119615)
lysnikolaou May 28, 2024
cfcc054
GH-119476: Split _CHECK_FUNCTION_VERSION out of _CHECK_FUNCTION_EXACT…
brandtbucher May 28, 2024
5cd3ffd
GH-119258: Handle STORE_ATTR_WITH_HINT in tier two (GH-119481)
brandtbucher May 28, 2024
606be66
gh-119538: Add missing expat build dependencies (#119647)
erlend-aasland May 28, 2024
548a11d
gh-117398: Convert datetime.IsoCalendarDate To A Heap Type (gh-119637)
ericsnowcurrently May 28, 2024
a8e35e8
gh-119443: Turn off from __future__ import annotations in REPL (#119493)
JelleZijlstra May 29, 2024
c0faade
gh-119704: Fix reference leak in the ``Python/Python-tokenize.c`` (#1…
Eclips4 May 29, 2024
86d1a1a
gh-119555: catch SyntaxError from compile() in the InteractiveColored…
skirpichev May 29, 2024
cd11ff1
gh-119613: Use C99+ functions instead of Py_IS_NAN/INFINITY/FINITE (#…
skirpichev May 29, 2024
7ca74a7
gh-119661: Add _Py_SINGLETON() include in Argumenet Clinic (#119712)
vstinner May 29, 2024
c1e9647
gh-119689: generate stack effect metadata for pseudo instructions (#1…
iritkatriel May 29, 2024
18c1a8d
gh-97588: Align ctypes struct layout to GCC/MSVC (GH-97702)
matthiasgoergens May 29, 2024
016a46a
gh-93554: add test for quickening of code in loops ending with condit…
iritkatriel May 29, 2024
0cdc5c8
gh-119613: Soft deprecate Py_IS_NAN/INFINITY/FINITE (#119701)
skirpichev May 29, 2024
055c739
CI: set correct working directory for Hypothesis cache (GH-119345)
Zac-HD May 29, 2024
1f481fd
gh-119273: Don't run test_ioctl in a process group (#119275)
vstinner May 29, 2024
34f9b3e
gh-119655: Fix reference leak in the ``_datetimemodule.c`` (gh-119713)
Eclips4 May 29, 2024
78d697b
gh-119690: Adds Unicode support for named pipes in _winapi (GH-119717)
zooba May 29, 2024
659cb7e
gh-119721: Integrate documentation fixes into heapq module docstring.…
filiplajszczak May 29, 2024
c8b45a3
gh-118673: Remove shebang and executable bits from stdlib modules. (#…
jaraco May 29, 2024
0751511
gh-93963: Remove deprecated names from importlib.abc (#119720)
hugovk May 29, 2024
bf4ff3a
gh-119260: Clarify is_dataclass Behavior for Subclasses in Documentat…
adiaholic May 29, 2024
fcca08e
gh-119594: Improve pow(fraction.Fraction(), b, modulo) error message …
wimglenn May 29, 2024
df93f5d
gh-119070: Fix py.exe handling of /usr/bin/env commands missing exten…
zooba May 29, 2024
c22323c
gh-119525: Fix deadlock with `_PyType_Lookup` and the GIL (#119527)
colesbury May 29, 2024
a150679
GH-89727: Partially fix `shutil.rmtree()` recursion error on deep tre…
barneygale May 29, 2024
7ff61f5
GH-119169: Implement `pathlib.Path.walk()` using `os.walk()` (#119573)
barneygale May 29, 2024
2cc3502
subprocess docs: Fix semantically important typo (GH-119752)
zware May 29, 2024
3c890b5
GH-89727: Fix `os.fwalk()` recursion error on deep trees (#119638)
barneygale May 30, 2024
a5fef80
GH-89727: Fix FD leak on `os.fwalk()` generator finalization. (#119766)
barneygale May 30, 2024
48f21b3
gh-118235: Move RAISE_SYNTAX_ERROR actions to invalid rules and make …
encukou May 30, 2024
db00934
gh-118055: Update the finder glossary entry (GH-118278)
Lincoln-developer May 30, 2024
b1374aa
gh-110383: Remove references to removed popen[234] (GH-112783)
shenanigansd May 30, 2024
e50fac9
gh-119336: Restore removed _PyLong_NumBits() function (#119418)
emmatyping May 30, 2024
6fb191b
gh-119779: Fix pyporting howto docs (#119785)
SweetyAngel May 30, 2024
e91fc11
gh-119786: create folder in cpython repo for internals documentation …
iritkatriel May 30, 2024
e875c2d
gh-119791: Fix new Tkinter tests for wantobjects=0 (GH-119792)
serhiy-storchaka May 30, 2024
bf098d4
gh-109218: Refactor tests for the complex() constructor (GH-119635)
serhiy-storchaka May 30, 2024
1c04c63
gh-119729: Use 't' in pkg-config file name for free-threaded build (#…
colesbury May 30, 2024
ec1ba26
gh-109218: Improve documentation for the complex() constructor (GH-11…
serhiy-storchaka May 30, 2024
deda857
Docs: `shutil.rmtree`'s `onerror` has no pending removal version (#11…
hugovk May 30, 2024
ef01e95
gh-109218: Deprecate weird cases in the complex() constructor (GH-119…
serhiy-storchaka May 30, 2024
9732ed5
gh-107262: Update Tkinter tests for Tcl/Tk 8.6.14 (GH-119322)
DBJim May 30, 2024
13a5fdc
gh-119744: move a few functions from compile.c to flowgraph.c (#119745)
iritkatriel May 30, 2024
38d9c11
better variable names and mini corrections
dg-pb May 31, 2024
39a18f8
Initial Implementation
dg-pb May 21, 2024
ee0e1f3
serialization fix
dg-pb May 21, 2024
353ac4d
bug fix
dg-pb May 21, 2024
d287026
Bug 2 fix
dg-pb May 21, 2024
df8ea4c
Py_TPFLAGS_IMMUTABLETYPE added
dg-pb May 21, 2024
0081cbd
placeholder added to state as opposed to being used as global constant
dg-pb May 23, 2024
4b329cd
static removed
dg-pb May 23, 2024
1669ca7
creating sentinel via PyType_Spec
dg-pb May 23, 2024
becd259
more accurate variable name
dg-pb May 23, 2024
6953ab7
trailing trim bug and tests
dg-pb May 24, 2024
544f774
Updated docs
dg-pb May 24, 2024
ce45640
blurb
dg-pb May 24, 2024
38e0ab7
minor edit
dg-pb May 24, 2024
1a5d45f
doc fix
dg-pb May 24, 2024
f5118bd
better variable names and mini corrections. Rebase
dg-pb May 31, 2024
73531ea
merge to main
dg-pb May 31, 2024
980383f
Merge remote-tracking branch 'origin/implement-119127' into implement…
dg-pb May 31, 2024
5a3c478
..
dg-pb May 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,21 @@ Objects/type* @markshannon
Objects/codeobject.c @markshannon
Objects/frameobject.c @markshannon
Objects/call.c @markshannon
Python/ceval*.c @markshannon @gvanrossum
Python/ceval*.h @markshannon @gvanrossum
Python/ceval*.c @markshannon
Python/ceval*.h @markshannon
Python/compile.c @markshannon @iritkatriel
Python/assemble.c @markshannon @iritkatriel
Python/flowgraph.c @markshannon @iritkatriel
Python/ast_opt.c @isidentical
Python/bytecodes.c @markshannon @gvanrossum
Python/optimizer*.c @markshannon @gvanrossum
Python/bytecodes.c @markshannon
Python/optimizer*.c @markshannon
Python/optimizer_analysis.c @Fidget-Spinner
Python/optimizer_bytecodes.c @Fidget-Spinner
Lib/_pyrepl/* @pablogsal @lysnikolaou @ambv
Lib/test/test_patma.py @brandtbucher
Lib/test/test_type_*.py @JelleZijlstra
Lib/test/test_capi/test_misc.py @markshannon @gvanrossum
Lib/test/test_capi/test_misc.py @markshannon
Lib/test/test_pyrepl/* @pablogsal @lysnikolaou @ambv
Tools/c-analyzer/ @ericsnowcurrently

# dbm
Expand Down Expand Up @@ -150,7 +152,7 @@ Include/internal/pycore_time.h @pganssle @abalkin
/Lib/test/test_tokenize.py @pablogsal @lysnikolaou

# Code generator
/Tools/cases_generator/ @gvanrossum
/Tools/cases_generator/ @markshannon

# AST
Python/ast.c @isidentical
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ jobs:
id: cache-hypothesis-database
uses: actions/cache@v4
with:
path: ./hypothesis
path: ${{ env.CPYTHON_BUILDDIR }}/.hypothesis/
key: hypothesis-database-${{ github.head_ref || github.run_id }}
restore-keys: |
- hypothesis-database-
Expand Down Expand Up @@ -416,7 +416,7 @@ jobs:
if: always()
with:
name: hypothesis-example-db
path: .hypothesis/examples/
path: ${{ env.CPYTHON_BUILDDIR }}/.hypothesis/examples/


build_asan:
Expand Down
6 changes: 5 additions & 1 deletion Doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,14 @@ gettext: build
htmlview: html
$(PYTHON) -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('build/html/index.html'))"

.PHONY: ensure-sphinx-autobuild
ensure-sphinx-autobuild: venv
$(VENVDIR)/bin/sphinx-autobuild --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install sphinx-autobuild

.PHONY: htmllive
htmllive: SPHINXBUILD = $(VENVDIR)/bin/sphinx-autobuild
htmllive: SPHINXOPTS = --re-ignore="/venv/" --open-browser --delay 0
htmllive: html
htmllive: ensure-sphinx-autobuild html

.PHONY: clean
clean: clean-venv
Expand Down
4 changes: 2 additions & 2 deletions Doc/c-api/buffer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ a buffer, see :c:func:`PyObject_GetBuffer`.
or a :c:macro:`PyBUF_WRITABLE` request, the consumer must disregard
:c:member:`~Py_buffer.itemsize` and assume ``itemsize == 1``.

.. c:member:: const char *format
.. c:member:: char *format

A *NUL* terminated string in :mod:`struct` module style syntax describing
A *NULL* terminated string in :mod:`struct` module style syntax describing
the contents of a single item. If this is ``NULL``, ``"B"`` (unsigned bytes)
is assumed.

Expand Down
6 changes: 6 additions & 0 deletions Doc/c-api/tuple.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ Tuple Objects
is being replaced; any reference in the tuple at position *pos* will be
leaked.

.. warning::

This macro should *only* be used on tuples that are newly created.
Using this macro on a tuple that is already in use (or in other words, has
a refcount > 1) could lead to undefined behavior.


.. c:function:: int _PyTuple_Resize(PyObject **p, Py_ssize_t newsize)

Expand Down
4 changes: 2 additions & 2 deletions Doc/c-api/weakref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ as much as it can.
callable object that receives notification when *ob* is garbage collected; it
should accept a single parameter, which will be the weak reference object
itself. *callback* may also be ``None`` or ``NULL``. If *ob* is not a
weakly referencable object, or if *callback* is not callable, ``None``, or
weakly referenceable object, or if *callback* is not callable, ``None``, or
``NULL``, this will return ``NULL`` and raise :exc:`TypeError`.


Expand All @@ -47,7 +47,7 @@ as much as it can.
be a callable object that receives notification when *ob* is garbage
collected; it should accept a single parameter, which will be the weak
reference object itself. *callback* may also be ``None`` or ``NULL``. If *ob*
is not a weakly referencable object, or if *callback* is not callable,
is not a weakly referenceable object, or if *callback* is not callable,
``None``, or ``NULL``, this will return ``NULL`` and raise :exc:`TypeError`.


Expand Down
2 changes: 1 addition & 1 deletion Doc/extending/extending.rst
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ It is important to call :c:func:`free` at the right time. If a block's address
is forgotten but :c:func:`free` is not called for it, the memory it occupies
cannot be reused until the program terminates. This is called a :dfn:`memory
leak`. On the other hand, if a program calls :c:func:`free` for a block and then
continues to use the block, it creates a conflict with re-use of the block
continues to use the block, it creates a conflict with reuse of the block
through another :c:func:`malloc` call. This is called :dfn:`using freed memory`.
It has the same bad consequences as referencing uninitialized data --- core
dumps, wrong results, mysterious crashes.
Expand Down
2 changes: 1 addition & 1 deletion Doc/extending/newtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ performance-critical objects (such as numbers).
.. seealso::
Documentation for the :mod:`weakref` module.

For an object to be weakly referencable, the extension type must set the
For an object to be weakly referenceable, the extension type must set the
``Py_TPFLAGS_MANAGED_WEAKREF`` bit of the :c:member:`~PyTypeObject.tp_flags`
field. The legacy :c:member:`~PyTypeObject.tp_weaklistoffset` field should
be left as zero.
Expand Down
4 changes: 2 additions & 2 deletions Doc/faq/general.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ available. Consult `the Python Package Index <https://pypi.org>`_ to
find packages of interest to you.


.. _faq-version-numbering-scheme:

How does the Python version numbering scheme work?
--------------------------------------------------

Expand Down Expand Up @@ -183,8 +185,6 @@ information on getting the source code and compiling it.
How do I get documentation on Python?
-------------------------------------

.. XXX mention py3k

The standard documentation for the current stable version of Python is available
at https://docs.python.org/3/. PDF, plain text, and downloadable HTML versions are
also available at https://docs.python.org/3/download.html.
Expand Down
78 changes: 0 additions & 78 deletions Doc/faq/library.rst
Original file line number Diff line number Diff line change
Expand Up @@ -541,84 +541,6 @@ Thus, to read *n* bytes from a pipe *p* created with :func:`os.popen`, you need
use ``p.read(n)``.


.. XXX update to use subprocess. See the :ref:`subprocess-replacements` section.

How do I run a subprocess with pipes connected to both input and output?
------------------------------------------------------------------------

Use the :mod:`popen2` module. For example::

import popen2
fromchild, tochild = popen2.popen2("command")
tochild.write("input\n")
tochild.flush()
output = fromchild.readline()

Warning: in general it is unwise to do this because you can easily cause a
deadlock where your process is blocked waiting for output from the child
while the child is blocked waiting for input from you. This can be caused
by the parent expecting the child to output more text than it does or
by data being stuck in stdio buffers due to lack of flushing.
The Python parent can of course explicitly flush the data it sends to the
child before it reads any output, but if the child is a naive C program it
may have been written to never explicitly flush its output, even if it is
interactive, since flushing is normally automatic.

Note that a deadlock is also possible if you use :func:`popen3` to read
stdout and stderr. If one of the two is too large for the internal buffer
(increasing the buffer size does not help) and you ``read()`` the other one
first, there is a deadlock, too.

Note on a bug in popen2: unless your program calls ``wait()`` or
``waitpid()``, finished child processes are never removed, and eventually
calls to popen2 will fail because of a limit on the number of child
processes. Calling :func:`os.waitpid` with the :const:`os.WNOHANG` option can
prevent this; a good place to insert such a call would be before calling
``popen2`` again.

In many cases, all you really need is to run some data through a command and
get the result back. Unless the amount of data is very large, the easiest
way to do this is to write it to a temporary file and run the command with
that temporary file as input. The standard module :mod:`tempfile` exports a
:func:`~tempfile.mktemp` function to generate unique temporary file names. ::

import tempfile
import os

class Popen3:
"""
This is a deadlock-safe version of popen that returns
an object with errorlevel, out (a string) and err (a string).
(capturestderr may not work under windows.)
Example: print(Popen3('grep spam','\n\nhere spam\n\n').out)
"""
def __init__(self,command,input=None,capturestderr=None):
outfile=tempfile.mktemp()
command="( %s ) > %s" % (command,outfile)
if input:
infile=tempfile.mktemp()
open(infile,"w").write(input)
command=command+" <"+infile
if capturestderr:
errfile=tempfile.mktemp()
command=command+" 2>"+errfile
self.errorlevel=os.system(command) >> 8
self.out=open(outfile,"r").read()
os.remove(outfile)
if input:
os.remove(infile)
if capturestderr:
self.err=open(errfile,"r").read()
os.remove(errfile)

Note that many interactive programs (e.g. vi) don't work well with pipes
substituted for standard input and output. You will have to use pseudo ttys
("ptys") instead of pipes. Or you can use a Python interface to Don Libes'
"expect" library. A Python extension that interfaces to expect is called
"expy" and available from https://expectpy.sourceforge.net. A pure Python
solution that works like expect is :pypi:`pexpect`.


How do I access the serial (RS232) port?
----------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions Doc/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -425,11 +425,11 @@ Glossary
An object that tries to find the :term:`loader` for a module that is
being imported.

Since Python 3.3, there are two types of finder: :term:`meta path finders
There are two types of finder: :term:`meta path finders
<meta path finder>` for use with :data:`sys.meta_path`, and :term:`path
entry finders <path entry finder>` for use with :data:`sys.path_hooks`.

See :pep:`302`, :pep:`420` and :pep:`451` for much more detail.
See :ref:`importsystem` and :mod:`importlib` for much more detail.

floor division
Mathematical division that rounds down to nearest integer. The floor
Expand Down
2 changes: 1 addition & 1 deletion Doc/howto/mro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ In this case the MRO is GFEF and the local precedence ordering is
preserved.

As a general rule, hierarchies such as the previous one should be
avoided, since it is unclear if F should override E or viceversa.
avoided, since it is unclear if F should override E or vice-versa.
Python 2.3 solves the ambiguity by raising an exception in the creation
of class G, effectively stopping the programmer from generating
ambiguous hierarchies. The reason for that is that the C3 algorithm
Expand Down
4 changes: 2 additions & 2 deletions Doc/howto/pyporting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ please see :ref:`cporting-howto`.

The archived python-porting_ mailing list may contain some useful guidance.

Since Python 3.13 the original porting guide was discontinued.
Since Python 3.11 the original porting guide was discontinued.
You can find the old guide in the
`archive <https://docs.python.org/3.12/howto/pyporting.html>`_.
`archive <https://docs.python.org/3.10/howto/pyporting.html>`_.


Third-party guides
Expand Down
7 changes: 2 additions & 5 deletions Doc/library/cmath.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ Conversions to and from polar coordinates

A Python complex number ``z`` is stored internally using *rectangular*
or *Cartesian* coordinates. It is completely determined by its *real
part* ``z.real`` and its *imaginary part* ``z.imag``. In other
words::

z == z.real + z.imag*1j
part* ``z.real`` and its *imaginary part* ``z.imag``.

*Polar coordinates* give an alternative way to represent a complex
number. In polar coordinates, a complex number *z* is defined by the
Expand Down Expand Up @@ -90,7 +87,7 @@ rectangular coordinates to polar coordinates and back.
.. function:: rect(r, phi)

Return the complex number *x* with polar coordinates *r* and *phi*.
Equivalent to ``r * (math.cos(phi) + math.sin(phi)*1j)``.
Equivalent to ``complex(r * math.cos(phi), r * math.sin(phi))``.


Power and logarithmic functions
Expand Down
45 changes: 37 additions & 8 deletions Doc/library/ctypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -661,14 +661,18 @@ for debugging because they can provide useful information::
guaranteed by the library to work in the general case. Unions and
structures with bit-fields should always be passed to functions by pointer.

Structure/union alignment and byte order
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

By default, Structure and Union fields are aligned in the same way the C
compiler does it. It is possible to override this behavior by specifying a
:attr:`~Structure._pack_` class attribute in the subclass definition.
This must be set to a positive integer and specifies the maximum alignment for the fields.
This is what ``#pragma pack(n)`` also does in MSVC.
Structure/union layout, alignment and byte order
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

By default, Structure and Union fields are laid out in the same way the C
compiler does it. It is possible to override this behavior entirely by specifying a
:attr:`~Structure._layout_` class attribute in the subclass definition; see
the attribute documentation for details.

It is possible to specify the maximum alignment for the fields by setting
the :attr:`~Structure._pack_` class attribute to a positive integer.
This matches what ``#pragma pack(n)`` does in MSVC.

It is also possible to set a minimum alignment for how the subclass itself is packed in the
same way ``#pragma align(n)`` works in MSVC.
This can be achieved by specifying a ::attr:`~Structure._align_` class attribute
Expand Down Expand Up @@ -2540,6 +2544,31 @@ fields, or any other data types containing pointer type fields.
the structure when being packed or unpacked to/from memory.
Setting this attribute to 0 is the same as not setting it at all.

.. attribute:: _layout_

An optional string naming the struct/union layout. It can currently
be set to:

- ``"ms"``: the layout used by the Microsoft compiler (MSVC).
On GCC and Clang, this layout can be selected with
``__attribute__((ms_struct))``.
- ``"gcc-sysv"``: the layout used by GCC with the System V or “SysV-like”
data model, as used on Linux and macOS.
With this layout, :attr:`~Structure._pack_` must be unset or zero.

If not set explicitly, ``ctypes`` will use a default that
matches the platform conventions. This default may change in future
Python releases (for example, when a new platform gains official support,
or when a difference between similar platforms is found).
Currently the default will be:

- On Windows: ``"ms"``
- When :attr:`~Structure._pack_` is specified: ``"ms"``
- Otherwise: ``"gcc-sysv"``

:attr:`!_layout_` must already be defined when
:attr:`~Structure._fields_` is assigned, otherwise it will have no effect.

.. attribute:: _anonymous_

An optional sequence that lists the names of unnamed (anonymous) fields.
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/curses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ the following methods and attributes:

.. method:: window.getbegyx()

Return a tuple ``(y, x)`` of co-ordinates of upper-left corner.
Return a tuple ``(y, x)`` of coordinates of upper-left corner.


.. method:: window.getbkgd()
Expand Down
4 changes: 2 additions & 2 deletions Doc/library/dataclasses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,8 @@ Module contents

.. function:: is_dataclass(obj)

Return ``True`` if its parameter is a dataclass or an instance of one,
otherwise return ``False``.
Return ``True`` if its parameter is a dataclass (including subclasses of a
dataclass) or an instance of one, otherwise return ``False``.

If you need to know if a class is an instance of a dataclass (and
not a dataclass itself), then add a further check for ``not
Expand Down
Loading