diff --git a/Doc/library/colorsys.rst b/Doc/library/colorsys.rst index dffc16ae8b7d475..35873c9de619de2 100644 --- a/Doc/library/colorsys.rst +++ b/Doc/library/colorsys.rst @@ -19,7 +19,7 @@ spaces, the coordinates are all between 0 and 1. .. seealso:: More information about color spaces can be found at - https://poynton.ca/ColorFAQ.html and + https://www.poynton.ca/pdf/ColourFAQ.pdf and https://www.cambridgeincolour.com/tutorials/color-spaces.htm. The :mod:`!colorsys` module defines the following functions: diff --git a/Doc/library/importlib.metadata.rst b/Doc/library/importlib.metadata.rst index e11db37b9fad501..1378a131f0ce651 100644 --- a/Doc/library/importlib.metadata.rst +++ b/Doc/library/importlib.metadata.rst @@ -90,6 +90,7 @@ collection of :ref:`EntryPoint ` objects. You can get the :ref:`metadata for a distribution `:: + >>> from importlib.metadata import metadata # doctest: +SKIP >>> list(metadata('wheel')) # doctest: +SKIP ['Metadata-Version', 'Name', 'Version', 'Summary', 'Home-page', 'Author', 'Author-email', 'Maintainer', 'Maintainer-email', 'License', 'Project-URL', 'Project-URL', 'Project-URL', 'Keywords', 'Platform', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Requires-Python', 'Provides-Extra', 'Requires-Dist', 'Requires-Dist'] diff --git a/Doc/using/windows.rst b/Doc/using/windows.rst index 3a32c193e3a8fc8..5dfc16fe68b26d5 100644 --- a/Doc/using/windows.rst +++ b/Doc/using/windows.rst @@ -943,6 +943,37 @@ checking for that feed. } +Proxy Settings +-------------- + +.. versionadded:: 26.4 + +By default, the Python install manager will use your system-wide proxy settings, +including automatic authentication. For most users, this behaves the same as +your browser and other applications. + +To override the settings, use the ``NO_PROXY``, ``HTTP_PROXY`` and +``HTTPS_PROXY`` environment variables. These should be set in the terminal +session before using the Python install manager. Other applications may also +use the variables, so use caution before setting them globally for your entire +machine. + +Setting ``NO_PROXY`` to any non-empty value will disable the use of any proxy. +Use this to bypass your system's default proxy setting and attempt to access the +index server directly. + +Setting ``HTTPS_PROXY`` to a string like ``example.com:8080`` will connect to +that proxy server for all HTTPS connections. For the default index, all +connections will be using HTTPS, and so this is the usual setting to override. + +The ``HTTP_PROXY`` variable may be needed if you are using a private index +server that does not use encrypted connections, but does require the default +proxy server to be overridden. It follows the same format as ``HTTPS_PROXY``. + +Credentials may be embedded in either setting, however, when ``HTTPS_PROXY`` has +credentials embedded they will be used in preference to other credentials. Only +one set of credentials will be used for both types of proxy. + .. _pymanager-troubleshoot: Troubleshooting diff --git a/Include/cpython/object.h b/Include/cpython/object.h index 4c5a677e5543ece..0ef52d4d2bc7b4b 100644 --- a/Include/cpython/object.h +++ b/Include/cpython/object.h @@ -352,7 +352,7 @@ PyAPI_FUNC(PyObject *) _PyObject_FunctionStr(PyObject *); #ifdef _Py_TYPEOF #define Py_SETREF(dst, src) \ do { \ - _Py_TYPEOF(dst)* _tmp_dst_ptr = &(dst); \ + _Py_TYPEOF(&(dst)) _tmp_dst_ptr = &(dst); \ _Py_TYPEOF(dst) _tmp_old_dst = (*_tmp_dst_ptr); \ *_tmp_dst_ptr = (src); \ Py_DECREF(_tmp_old_dst); \ @@ -374,7 +374,7 @@ PyAPI_FUNC(PyObject *) _PyObject_FunctionStr(PyObject *); #ifdef _Py_TYPEOF #define Py_XSETREF(dst, src) \ do { \ - _Py_TYPEOF(dst)* _tmp_dst_ptr = &(dst); \ + _Py_TYPEOF(&(dst)) _tmp_dst_ptr = &(dst); \ _Py_TYPEOF(dst) _tmp_old_dst = (*_tmp_dst_ptr); \ *_tmp_dst_ptr = (src); \ Py_XDECREF(_tmp_old_dst); \ diff --git a/Include/pyport.h b/Include/pyport.h index 03f9b869bc82b55..744bae6c57e299e 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -538,15 +538,18 @@ extern "C" { // // Example: _Py_TYPEOF(x) x_copy = (x); // -// On C23, use typeof(). Otherwise __typeof__() if on GCC, clang or -// MSVC 17.9 and newer. Else if on C++11 or newer, decltype() is used. +// On C23, use typeof(). On C++11, use decltype(). Otherwise, use __typeof__() +// if on GCC, clang or MSVC 17.9 and newer. +// +// On MSVC, check also _MSVC_LANG since __cplusplus is 199711L unless +// the /Zc:__cplusplus flag is used. #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 202311L # define _Py_TYPEOF(expr) typeof(expr) +#elif defined(__cplusplus) && (__cplusplus >= 201103L || _MSVC_LANG >= 201103L) +# define _Py_TYPEOF(expr) decltype(expr) #elif defined(__GNUC__) || defined(__clang__) || \ (defined(_MSC_VER) && _MSC_VER >= 1939) # define _Py_TYPEOF(expr) __typeof__(expr) -#elif defined(__cplusplus) && __cplusplus >= 201103L -# define _Py_TYPEOF(expr) decltype(expr) #endif diff --git a/Include/refcount.h b/Include/refcount.h index b21697ae1780fa8..d96c75421aef337 100644 --- a/Include/refcount.h +++ b/Include/refcount.h @@ -482,7 +482,7 @@ static inline Py_ALWAYS_INLINE void Py_DECREF(PyObject *op) #ifdef _Py_TYPEOF #define Py_CLEAR(op) \ do { \ - _Py_TYPEOF(op)* _tmp_op_ptr = &(op); \ + _Py_TYPEOF(&(op)) _tmp_op_ptr = &(op); \ _Py_TYPEOF(op) _tmp_old_op = (*_tmp_op_ptr); \ if (_tmp_old_op != _Py_NULL) { \ *_tmp_op_ptr = _Py_NULL; \ diff --git a/Misc/NEWS.d/next/Build/2026-08-14-20-16-55.gh-issue-153400.9Oxi-N.rst b/Misc/NEWS.d/next/Build/2026-08-14-20-16-55.gh-issue-153400.9Oxi-N.rst new file mode 100644 index 000000000000000..17241c897905b0e --- /dev/null +++ b/Misc/NEWS.d/next/Build/2026-08-14-20-16-55.gh-issue-153400.9Oxi-N.rst @@ -0,0 +1 @@ +Support os.getrandom() when building Python with old glibc versions and recent Linux kernel (glibc 2.25 or older and Linux kernel 3.17 or newer). Get the syscall number from kernel headers, rather than glibc headers. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 7636d51485c730d..ead2371e3414414 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -161,6 +161,9 @@ #ifdef HAVE_SYS_SYSCALL_H # include // syscall(), __NR_xxx syscall numbers #endif +#if !defined(SYS_getrandom) && defined(__NR_getrandom) +# define SYS_getrandom __NR_getrandom +#endif #ifdef HAVE_POSIX_SPAWN # include // posix_spawn() diff --git a/Python/bootstrap_hash.c b/Python/bootstrap_hash.c index 5bc45d503360376..a22688827612657 100644 --- a/Python/bootstrap_hash.c +++ b/Python/bootstrap_hash.c @@ -23,7 +23,10 @@ # include // getrandom() # endif # if !defined(HAVE_GETRANDOM) && defined(HAVE_GETRANDOM_SYSCALL) -# include // SYS_getrandom +# include // __NR_getrandom, SYS_getrandom +# if !defined(SYS_getrandom) && defined(__NR_getrandom) +# define SYS_getrandom __NR_getrandom +# endif # endif #endif diff --git a/configure b/configure index ae3f0450dc7af1b..7d6c321ae38130b 100755 --- a/configure +++ b/configure @@ -34338,7 +34338,11 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #include #include #include - #include + #include // GRND_NONBLOCK + + #if !defined(SYS_getrandom) && defined(__NR_getrandom) + # define SYS_getrandom __NR_getrandom + #endif int main(void) { char buffer[1]; diff --git a/configure.ac b/configure.ac index 1c42900cb975c35..0cf27376015aef9 100644 --- a/configure.ac +++ b/configure.ac @@ -7895,7 +7895,11 @@ AC_LINK_IFELSE( #include #include #include - #include + #include // GRND_NONBLOCK + + #if !defined(SYS_getrandom) && defined(__NR_getrandom) + # define SYS_getrandom __NR_getrandom + #endif int main(void) { char buffer[1];