Skip to content

Commit 4807c36

Browse files
authored
Merge branch 'main' into wr-132413
2 parents 26c6425 + f41e9c7 commit 4807c36

38 files changed

+265
-178
lines changed

.github/workflows/posix-deps-apt.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,10 @@ apt-get -yq install \
2525
uuid-dev \
2626
xvfb \
2727
zlib1g-dev
28+
29+
# Workaround missing libmpdec-dev on ubuntu 24.04:
30+
# https://launchpad.net/~ondrej/+archive/ubuntu/php
31+
# https://deb.sury.org/
32+
sudo add-apt-repository ppa:ondrej/php
33+
apt-get update
34+
apt-get -yq install libmpdec-dev

Doc/c-api/init.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2277,6 +2277,18 @@ The C-API provides a basic mutual exclusion lock.
22772277
22782278
.. versionadded:: 3.13
22792279
2280+
.. c:function:: int PyMutex_IsLocked(PyMutex *m)
2281+
2282+
Returns non-zero if the mutex *m* is currently locked, zero otherwise.
2283+
2284+
.. note::
2285+
2286+
This function is intended for use in assertions and debugging only and
2287+
should not be used to make concurrency control decisions, as the lock
2288+
state may change immediately after the check.
2289+
2290+
.. versionadded:: next
2291+
22802292
.. _python-critical-section-api:
22812293
22822294
Python Critical Section API

Doc/deprecations/pending-removal-in-3.15.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ Pending removal in Python 3.15
9797
After eight years in the :mod:`typing` module,
9898
it has yet to be supported by any major type checker.
9999

100+
* :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules.
101+
100102
* :mod:`wave`:
101103

102104
* The ``getmark()``, ``setmark()`` and ``getmarkers()`` methods of

Doc/deprecations/pending-removal-in-future.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ although there is currently no date scheduled for their removal.
8989
underscore.
9090
(Contributed by Serhiy Storchaka in :gh:`91760`.)
9191

92-
* :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules.
93-
9492
* :mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in
9593
Python 3.12; use the *onexc* parameter instead.
9694

Doc/library/fractions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ another rational number, or from a string.
142142

143143
.. versionadded:: 3.12
144144

145-
.. classmethod:: from_float(flt)
145+
.. classmethod:: from_float(f)
146146

147147
Alternative constructor which only accepts instances of
148148
:class:`float` or :class:`numbers.Integral`. Beware that

Doc/whatsnew/3.15.rst

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,15 @@ shelve
140140
sqlite3
141141
-------
142142

143-
* Support SQL keyword completion in the :mod:`sqlite3` command-line interface.
144-
(Contributed by Long Tan in :gh:`133393`.)
143+
* The :ref:`command-line interface <sqlite3-cli>` has several new features:
144+
145+
* SQL keyword completion on <tab>.
146+
(Contributed by Long Tan in :gh:`133393`.)
147+
148+
* Prompts, error messages, and help text are now colored.
149+
This is enabled by default, see :ref:`using-on-controlling-color` for
150+
details.
151+
(Contributed by Stan Ulbrych and Łukasz Langa in :gh:`133461`)
145152

146153

147154
ssl
@@ -245,6 +252,13 @@ platform
245252
(Contributed by Alexey Makridenko in :gh:`133604`.)
246253

247254

255+
sre_*
256+
-----
257+
258+
* Removed :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules.
259+
(Contributed by Stan Ulbrych in :gh:`135994`.)
260+
261+
248262
sysconfig
249263
---------
250264

@@ -296,6 +310,11 @@ that may require changes to your code.
296310
Build changes
297311
=============
298312

313+
* Removed implicit fallback to the bundled copy of the ``libmpdec`` library.
314+
Now this should be explicitly enabled with :option:`--with-system-libmpdec`
315+
set to ``no`` or with :option:`!--without-system-libmpdec`.
316+
(Contributed by Sergey B Kirpichev in :gh:`115119`.)
317+
299318

300319
C API changes
301320
=============
@@ -327,6 +346,13 @@ Porting to Python 3.15
327346

328347
(Contributed by Serhiy Storchaka in :gh:`133595`.)
329348

349+
* Private functions promoted to public C APIs:
350+
351+
* ``PyMutex_IsLocked()`` : :c:func:`PyMutex_IsLocked`
352+
353+
The |pythoncapi_compat_project| can be used to get most of these new
354+
functions on Python 3.14 and older.
355+
330356
Deprecated C APIs
331357
-----------------
332358

Include/cpython/lock.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ PyAPI_FUNC(void) PyMutex_Lock(PyMutex *m);
3636
// exported function for unlocking the mutex
3737
PyAPI_FUNC(void) PyMutex_Unlock(PyMutex *m);
3838

39+
// exported function for checking if the mutex is locked
40+
PyAPI_FUNC(int) PyMutex_IsLocked(PyMutex *m);
41+
3942
// Locks the mutex.
4043
//
4144
// If the mutex is currently locked, the calling thread will be parked until
@@ -61,3 +64,11 @@ _PyMutex_Unlock(PyMutex *m)
6164
}
6265
}
6366
#define PyMutex_Unlock _PyMutex_Unlock
67+
68+
// Checks if the mutex is currently locked.
69+
static inline int
70+
_PyMutex_IsLocked(PyMutex *m)
71+
{
72+
return (_Py_atomic_load_uint8(&m->_bits) & _Py_LOCKED) != 0;
73+
}
74+
#define PyMutex_IsLocked _PyMutex_IsLocked

Include/internal/pycore_lock.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@ PyMutex_LockFast(PyMutex *m)
2525
return _Py_atomic_compare_exchange_uint8(lock_bits, &expected, _Py_LOCKED);
2626
}
2727

28-
// Checks if the mutex is currently locked.
29-
static inline int
30-
PyMutex_IsLocked(PyMutex *m)
31-
{
32-
return (_Py_atomic_load_uint8(&m->_bits) & _Py_LOCKED) != 0;
33-
}
34-
3528
// Re-initializes the mutex after a fork to the unlocked state.
3629
static inline void
3730
_PyMutex_at_fork_reinit(PyMutex *m)

Include/internal/pycore_object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ extern PyObject *_PyType_LookupRefAndVersion(PyTypeObject *, PyObject *,
918918
extern unsigned int
919919
_PyType_LookupStackRefAndVersion(PyTypeObject *type, PyObject *name, _PyStackRef *out);
920920

921-
extern int _PyObject_GetMethodStackRef(PyThreadState *ts, PyObject *obj,
921+
PyAPI_FUNC(int) _PyObject_GetMethodStackRef(PyThreadState *ts, PyObject *obj,
922922
PyObject *name, _PyStackRef *method);
923923

924924
// Cache the provided init method in the specialization cache of type if the

Include/internal/pycore_pystate.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ extern "C" {
88
# error "this header requires Py_BUILD_CORE define"
99
#endif
1010

11+
#include "pycore_pythonrun.h" // _PyOS_STACK_MARGIN_SHIFT
1112
#include "pycore_typedefs.h" // _PyRuntimeState
1213
#include "pycore_tstate.h"
1314

@@ -325,7 +326,7 @@ _Py_RecursionLimit_GetMargin(PyThreadState *tstate)
325326
_PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate;
326327
assert(_tstate->c_stack_hard_limit != 0);
327328
intptr_t here_addr = _Py_get_machine_stack_pointer();
328-
return Py_ARITHMETIC_RIGHT_SHIFT(intptr_t, here_addr - (intptr_t)_tstate->c_stack_soft_limit, PYOS_STACK_MARGIN_SHIFT);
329+
return Py_ARITHMETIC_RIGHT_SHIFT(intptr_t, here_addr - (intptr_t)_tstate->c_stack_soft_limit, _PyOS_STACK_MARGIN_SHIFT);
329330
}
330331

331332
#ifdef __cplusplus

0 commit comments

Comments
 (0)