Skip to content

Commit b319d9f

Browse files
Merge branch 'main' into syslog-handler-local
Resolve conflicts with gh-70990 (bytes UNIX socket addresses) in the SysLogHandler docstring and documentation: keep both the "string or bytes" wording and the address=None note. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2 parents 44626e9 + 46acb79 commit b319d9f

60 files changed

Lines changed: 1048 additions & 148 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.

Doc/library/ctypes.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,8 +708,7 @@ Specifying function pointers using type annotations
708708

709709
@wrap_dll_function(dll_to_wrap)
710710
def function_ptr_name(arg_name: ctypes_type, ...) -> ctypes_type:
711-
# There should be no body
712-
pass
711+
"""Optional docstring. There should be no function body."""
713712

714713
The body of the decorated function is ignored, and any parameters that are
715714
missing type annotations are skipped. The names of the parameters are ignored

Doc/library/exceptions.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ The following exceptions are the exceptions that are usually raised.
215215

216216
The object that was accessed for the named attribute.
217217

218+
When possible, :attr:`name` and :attr:`obj` are set automatically.
219+
218220
.. versionchanged:: 3.10
219221
Added the :attr:`name` and :attr:`obj` attributes.
220222

Doc/library/logging.handlers.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,8 @@ supports sending logging messages to a remote or local Unix syslog.
631631
the form of a ``(host, port)`` tuple. If *address* is not specified,
632632
``('localhost', 514)`` is used. The address is used to open a socket. An
633633
alternative to providing a ``(host, port)`` tuple is providing an address as a
634-
string, for example '/dev/log'. In this case, a Unix domain socket is used to
634+
string or a :class:`bytes` object, for example '/dev/log'.
635+
In this case, a Unix domain socket is used to
635636
send the message to the syslog.
636637
If *address* is ``None``, the :mod:`syslog` module is used to log to the
637638
local system logger; this works even where there is no syslog socket, such
@@ -670,6 +671,7 @@ supports sending logging messages to a remote or local Unix syslog.
670671
*timeout* was added.
671672

672673
.. versionchanged:: next
674+
*address* can now be a :class:`bytes` object.
673675
*address* can now be ``None`` to use the :mod:`syslog` module.
674676

675677
.. method:: close()

Doc/library/msvcrt.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,23 @@ Console I/O
135135

136136
.. function:: putch(char)
137137

138-
Print the byte string *char* to the console without buffering.
138+
Print the byte string *char* to the console without buffering. Raises
139+
:exc:`OSError` on failure, for example when the process has no console
140+
attached.
141+
142+
.. versionchanged:: next
143+
Failures are now reported by raising :exc:`OSError` instead of being
144+
silently ignored.
139145

140146

141147
.. function:: putwch(unicode_char)
142148

143149
Wide char variant of :func:`putch`, accepting a Unicode value.
144150

151+
.. versionchanged:: next
152+
Failures are now reported by raising :exc:`OSError` instead of being
153+
silently ignored.
154+
145155

146156
.. function:: ungetch(char)
147157

Doc/library/stdtypes.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4876,8 +4876,9 @@ copying.
48764876
Cast a memoryview to a new format or shape. *shape* defaults to
48774877
``[byte_length//new_itemsize]``, which means that the result view
48784878
will be one-dimensional. The return value is a new memoryview, but
4879-
the buffer itself is not copied. Supported casts are 1D -> C-:term:`contiguous`
4880-
and C-contiguous -> 1D.
4879+
the buffer itself is not copied. Supported casts are
4880+
1D -> C-:term:`contiguous`, C-contiguous -> 1D, and
4881+
F-contiguous -> 1D.
48814882

48824883
The destination format is restricted to a single element native format in
48834884
:mod:`struct` syntax. One of the formats must be a byte format
@@ -4964,6 +4965,10 @@ copying.
49644965
.. versionchanged:: 3.5
49654966
The source format is no longer restricted when casting to a byte view.
49664967

4968+
.. versionchanged:: next
4969+
Casting a multi-dimensional F-contiguous view to a one-dimensional
4970+
view is now supported.
4971+
49674972
.. method:: count(value, /)
49684973

49694974
Count the number of occurrences of *value*.

Doc/whatsnew/3.16.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ New features
7575
Other language changes
7676
======================
7777

78+
* :meth:`memoryview.cast` now allows casting a multidimensional
79+
F-contiguous view to a one-dimensional view.
80+
(Contributed by Jaemin Park in :gh:`91484`.)
81+
7882
* :ref:`Frame objects <frame-objects>` now support :mod:`weak references
7983
<weakref>`. This allows associating extra data with active frames,
8084
for example in debuggers, without keeping the frames (and everything

Lib/asyncio/__main__.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,14 @@ def interrupt(self) -> None:
212212
loop = asyncio.new_event_loop()
213213
asyncio.set_event_loop(loop)
214214

215-
repl_locals = {'asyncio': asyncio}
216-
for key in {'__name__', '__package__',
217-
'__loader__', '__spec__',
218-
'__builtins__', '__file__'}:
219-
repl_locals[key] = locals()[key]
215+
repl_locals = {
216+
'asyncio': asyncio,
217+
'__name__': __name__,
218+
'__package__': None,
219+
'__loader__': __loader__,
220+
'__spec__': None,
221+
'__builtins__': __builtins__,
222+
}
220223

221224
console = AsyncIOInteractiveConsole(repl_locals, loop)
222225

Lib/asyncio/staggered.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,7 @@ def task_done(task):
9090
return
9191
unhandled_exceptions.append(exc)
9292

93-
async def run_one_coro(ok_to_start, previous_failed) -> None:
94-
# in eager tasks this waits for the calling task to append this task
95-
# to running_tasks, in regular tasks this wait is a no-op that does
96-
# not yield a future. See gh-124309.
97-
await ok_to_start.wait()
93+
async def run_one_coro(previous_failed) -> None:
9894
# Wait for the previous task to finish, or for delay seconds
9995
if previous_failed is not None:
10096
with contextlib.suppress(exceptions_mod.TimeoutError):
@@ -110,14 +106,13 @@ async def run_one_coro(ok_to_start, previous_failed) -> None:
110106
return
111107
# Start task that will run the next coroutine
112108
this_failed = locks.Event()
113-
next_ok_to_start = locks.Event()
114-
next_task = loop.create_task(run_one_coro(next_ok_to_start, this_failed))
109+
next_task = loop.create_task(
110+
run_one_coro(this_failed),
111+
eager_start=False,
112+
)
115113
futures.future_add_to_awaited_by(next_task, parent_task)
116114
running_tasks.add(next_task)
117115
next_task.add_done_callback(task_done)
118-
# next_task has been appended to running_tasks so next_task is ok to
119-
# start.
120-
next_ok_to_start.set()
121116
# Prepare place to put this coroutine's exceptions if not won
122117
exceptions.append(None)
123118
assert len(exceptions) == this_index + 1
@@ -149,13 +144,11 @@ async def run_one_coro(ok_to_start, previous_failed) -> None:
149144

150145
propagate_cancellation_error = None
151146
try:
152-
ok_to_start = locks.Event()
153-
first_task = loop.create_task(run_one_coro(ok_to_start, None))
147+
first_task = loop.create_task(run_one_coro(None), eager_start=False)
154148
futures.future_add_to_awaited_by(first_task, parent_task)
155149
running_tasks.add(first_task)
156150
first_task.add_done_callback(task_done)
157-
# first_task has been appended to running_tasks so first_task is ok to start.
158-
ok_to_start.set()
151+
# first_task has been appended to running_tasks before the event loop starts running it.
159152
propagate_cancellation_error = None
160153
# Make sure no tasks are left running if we leave this function
161154
while running_tasks:

Lib/asyncio/unix_events.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,8 @@ def __init__(self, loop, pipe, protocol, waiter=None, extra=None):
640640
self._conn_lost = 0
641641
self._closing = False # Set when close() or write_eof() called.
642642

643-
mode = os.fstat(self._fileno).st_mode
643+
pipe_stat = os.fstat(self._fileno)
644+
mode = pipe_stat.st_mode
644645
is_char = stat.S_ISCHR(mode)
645646
is_fifo = stat.S_ISFIFO(mode)
646647
is_socket = stat.S_ISSOCK(mode)
@@ -657,7 +658,19 @@ def __init__(self, loop, pipe, protocol, waiter=None, extra=None):
657658
# On AIX, the reader trick (to be notified when the read end of the
658659
# socket is closed) only works for sockets. On other platforms it
659660
# works for pipes and sockets. (Exception: OS X 10.4? Issue #19294.)
660-
if is_socket or (is_fifo and not sys.platform.startswith("aix")):
661+
# On macOS, the trick misfires for named FIFOs (but not for pipes
662+
# created with os.pipe(), which have st_nlink == 0): the write end
663+
# polls as readable whenever unread data sits in the FIFO, and no
664+
# event is delivered when the read end is closed, so it can only
665+
# ever report a false disconnection (gh-145030). The same xnu
666+
# behaviour applies on iOS/tvOS/watchOS (sys.platform is not
667+
# "darwin" there).
668+
is_named_fifo_on_apple = (
669+
sys.platform in {"darwin", "ios", "tvos", "watchos"}
670+
and is_fifo and pipe_stat.st_nlink > 0)
671+
if is_socket or (is_fifo
672+
and not sys.platform.startswith("aix")
673+
and not is_named_fifo_on_apple):
661674
# only start reading when connection_made() has been called
662675
self._loop.call_soon(self._loop._add_reader,
663676
self._fileno, self._read_ready)

Lib/ctypes/util.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,7 @@ def _findLib_ld(name):
429429
result = None
430430
try:
431431
p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
432-
stderr=subprocess.PIPE,
433-
universal_newlines=True)
432+
stderr=subprocess.PIPE)
434433
out, _ = p.communicate()
435434
res = re.findall(expr, os.fsdecode(out))
436435
for file in res:
@@ -590,6 +589,8 @@ def decorator(func):
590589

591590
ptr.restype = restype
592591
ptr.argtypes = tuple(annotations.values())
592+
functools.update_wrapper(ptr, func, updated=())
593+
593594
return ptr
594595

595596
return decorator

0 commit comments

Comments
 (0)