Commit Graph

457 Commits

Author SHA1 Message Date
Sergey B Kirpichev 6988ff02a5
gh-61103: Support double complex (_Complex) type in ctypes (#120894)
Example:

```pycon
>>> import ctypes
>>> ctypes.__STDC_IEC_559_COMPLEX__
1
>>> libm = ctypes.CDLL('libm.so.6')
>>> libm.clog.argtypes = [ctypes.c_double_complex]
>>> libm.clog.restype = ctypes.c_double_complex
>>> libm.clog(1+1j)
(0.34657359027997264+0.7853981633974483j)
```

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-01 10:54:33 +02:00
Erlend E. Aasland f80376b129
gh-113565: Improve and harden detection of curses dependencies (#119816)
1. Use pkg-config to check for ncursesw/panelw. If that fails, use 
   pkg-config to check for ncurses/panel.
2. Regardless of pkg-config output, search for curses/panel headers, so
   we're sure we have all defines in pyconfig.h.
3. Regardless of pkg-config output, check if libncurses or libncursesw
   contains the 'initscr' symbol; if it does _and_ pkg-config failed
   earlier, add the resulting -llib linker option to CURSES_LIBS.
   Ditto for 'update_panels' and PANEL_LIBS.
4. Wrap the rest of the checks with WITH_SAVE_ENV and make sure we're 
   using updated LIBS and CPPFLAGS for those.

Add the PY_CHECK_CURSES convenience macro.
2024-07-01 08:10:03 +00:00
blhsing 6d34938dc8
gh-120713: Normalize year with century for datetime.strftime (GH-120820) 2024-06-29 09:32:42 +03:00
Joshua Root 8515fd79fe
gh-117845: Detect libedit hook function signature in configure (#117870)
Older libedit versions (like Apple's) use a different type signature
for rl_startup_hook and rl_pre_input_hook. Add a configure check to
determine which signature is accepted by introducing the
Py_RL_STARTUP_HOOK_TAKES_ARGS macro in pyconfig.h.
2024-04-17 11:26:10 +02:00
Erlend E. Aasland 449c6da2bd
gh-115765: Don't use deprecated AC_EGREP_* macros in configure.ac (#116016)
Rewrite using AX_CHECK_DEFINE and AC_CHECK_TYPES.
2024-02-28 14:35:41 +01:00
Pablo Galindo Salgado 1752b51012
gh-115773: Add tests to exercise the _Py_DebugOffsets structure (#115774) 2024-02-28 10:17:34 +00:00
Erlend E. Aasland baae73d730
gh-115765: Don't use deprecated AC_CHECK_TYPE macro in configure.ac (#115792)
Instead use AC_CHECK_TYPES.
2024-02-22 10:04:15 +01:00
Malcolm Smith f35c7c070c
gh-114875: Require getgrent for building the grp extension module (#114876)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-02-03 00:30:52 +01:00
Matt Prodani e5e186609f
gh-112606: Use pthread_cond_timedwait_relative_np() in parking_lot.c when available (#112616)
Add a configure define for HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP and
replaces pthread_cond_timedwait() with pthread_cond_timedwait_relative_np()
for relative time when supported in semaphore waiting logic.
2024-01-30 22:22:17 +01:00
Soumendra Ganguly e351ca3c20
gh-85984: Add POSIX pseudo-terminal functions. (GH-102413)
Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-01-29 16:10:28 +00:00
Jakub Kulík 2b93f52242
gh-113117: Support posix_spawn in subprocess.Popen with close_fds=True (#113118)
Add support for `os.POSIX_SPAWN_CLOSEFROM` and
`posix_spawn_file_actions_addclosefrom_np` and have the `subprocess` module use
them when available.  This means `posix_spawn` can now be used in the default
`close_fds=True` situation on many platforms.

Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
2023-12-17 21:34:57 +00:00
Sam James c454e934d3
gh-112970: Detect and use closefrom() when available (#112969)
glibc-2.34 implements closefrom(3) using the same semantics as on BSD.
Check for closefrom() in configure and use the check result in
fileutils.c, rather than hardcoding a FreeBSD check.

Some implementations of closefrom() return an int. Explicitly discard 
the return value by casting it to void, to avoid future compiler
warnings.

Signed-off-by: Sam James <sam@gentoo.org>
2023-12-12 11:25:27 +01:00
Tian Gao e7e1116a78
gh-105323: Remove `WITH_APPLE_EDITLINE` to use the same declaration for all editline (gh-112513) 2023-12-05 23:52:28 +09:00
Hugo van Kemenade 3b3ec0d77f
gh-111863: Rename `Py_NOGIL` to `Py_GIL_DISABLED` (#111864)
Rename Py_NOGIL to Py_GIL_DISABLED
2023-11-20 15:52:00 +02:00
Dino Viehland 05f2f0ac92
gh-90815: Add mimalloc memory allocator (#109914)
* Add mimalloc v2.12

Modified src/alloc.c to remove include of alloc-override.c and not
compile new handler.

Did not include the following files:

 - include/mimalloc-new-delete.h
 - include/mimalloc-override.h
 - src/alloc-override-osx.c
 - src/alloc-override.c
 - src/static.c
 - src/region.c

mimalloc is thread safe and shares a single heap across all runtimes,
therefore finalization and getting global allocated blocks across all
runtimes is different.

* mimalloc: minimal changes for use in Python:

 - remove debug spam for freeing large allocations
 - use same bytes (0xDD) for freed allocations in CPython and mimalloc
   This is important for the test_capi debug memory tests

* Don't export mimalloc symbol in libpython.
* Enable mimalloc as Python allocator option.
* Add mimalloc MIT license.
* Log mimalloc in Lib/test/pythoninfo.py.
* Document new mimalloc support.
* Use macro defs for exports as done in:
  https://github.com/python/cpython/pull/31164/

Co-authored-by: Sam Gross <colesbury@gmail.com>
Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-10-30 15:43:11 +00:00
Jakub Kulík 3b1580af07
gh-78469: Declare missing sethostname for Solaris 10 (#109447)
Add OS version specific macro for Solaris: Py_SUNOS_VERSION.
2023-10-09 21:18:05 +00:00
Bo Anderson f4cb0d27cc
gh-109191: Fix build with newer editline (gh-110239) 2023-10-09 13:21:20 +00:00
Masaru Tsuchiyama de2a4036cb
gh-108277: Add os.timerfd_create() function (#108382)
Add wrapper for timerfd_create, timerfd_settime, and timerfd_gettime to os module.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-10-07 19:33:22 +02:00
Donghee Na 501939c9c1
gh-105323: Update readline module to detect apple editline variant (gh-108665) 2023-09-29 21:18:18 +09:00
Victor Stinner 4ba18099b7
gh-108765: Python.h no longer includes <ieeefp.h> (#108781)
Remove also the HAVE_IEEEFP_H macro: remove ieeefp.h from the
AC_CHECK_HEADERS() check of configure.ac.
2023-09-02 15:48:32 +02:00
Sam Gross b16ecb88e7
gh-108223: Add --disable-gil to configure (gh-108227)
The `--disable-gil` flags does not do anything yet other than define the
Py_NOGIL macro. This is intended to support setting up additional
buildbots.
2023-08-21 17:50:35 +00:00
Mina Galić f50c17243a
GH-107812: extend `socket`'s netlink support to FreeBSD (gh-107813) 2023-08-10 00:47:46 +00:00
justdan6 11c055f5ff
gh-106881: Check for linux/limits.h before including it (#107397)
* Check for linux/limits.h before including it

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-07-28 15:08:43 -07:00
Erlend E. Aasland 8a8ebf2e3d
GH-89886: Bump to GNU Autoconf v2.71 (#104925)
Co-authored-by: Christian Heimes <christian@python.org>
2023-06-01 23:44:25 +02:00
Erlend E. Aasland 9ab587b714
gh-89886: Rely on HAVE_SYS_TIME_H (#105058)
Quoting autoconf (v2.71):

    All current systems provide time.h; it need not be checked for.
    Not all systems provide sys/time.h, but those that do, all allow
    you to include it and time.h simultaneously.
2023-06-01 13:37:40 +02:00
Victor Stinner e4127eaa1e
gh-104773: PEP 594: Remove the crypt module (#104908)
Remove the crypt module and its private _crypt extension, deprecated
in Python 3.11.
2023-05-25 15:45:46 +02:00
Victor Stinner 17e1fe0f9b
gh-104773: PEP 594: Remove the nis module (#104897) 2023-05-25 00:08:36 +02:00
Petr Viktorin cd9a56c2b0
gh-103509: PEP 697 -- Limited C API for Extending Opaque Types (GH-103511)
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-05-04 09:56:53 +02:00
Noam Cohen 80c08d1cd6
gh-95389: expose popular ETHERTYPE_* constants in the socket module (#95390)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-11-07 15:27:37 +01:00
Noam Cohen a371a7e03e
gh-95023: Added os.setns and os.unshare functions (#95046)
Added os.setns and os.unshare to easily switch between namespaces
on Linux.

Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Victor Stinner <vstinner@python.org>
2022-10-20 11:08:54 +02:00
Pablo Galindo Salgado 6d791a9736
gh-96143: Allow Linux perf profiler to see Python calls (GH-96123)
⚠️  ⚠️ Note for reviewers, hackers and fellow systems/low-level/compiler engineers ⚠️ ⚠️ 

If you have a lot of experience with this kind of shenanigans and want to improve the **first** version, **please make a PR against my branch** or **reach out by email** or **suggest code changes directly on GitHub**. 

If you have any **refinements or optimizations** please, wait until the first version is merged before starting hacking or proposing those so we can keep this PR productive.
2022-08-30 10:11:18 -07:00
Christian Heimes 0fe645d6fd
gh-95174: Add pthread stubs for WASI (GH-95234)
Co-authored-by: Brett Cannon <brett@python.org>
2022-07-27 20:28:06 +02:00
Christian Heimes 8b24d60f1b
gh-95174: WASI: skip missing sockets functions (GH-95179) 2022-07-27 08:19:23 +02:00
Christian Heimes 0d35a59ce3
gh-95174: Handle missing dup() and constants in WASI (GH-95229)
- check for ``dup()`` libc function
- handle missing ``F_DUPFD`` in ``dup2()`` replacement function
- add workaround for WASI libc bug in MSG_TRUNC
- ESHUTDOWN is missing, use EPIPE instead
- POLLPRI is missing, define as 0 (no-op)
2022-07-26 11:16:51 +02:00
Christian Heimes e925241d95
gh-90005: Port readline and curses to PY_STDLIB_MOD (GH-94452)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
2022-07-06 11:56:25 +02:00
Christian Heimes ec5e253556
gh-90005: Port _dbm module to PY_STDLIB_MOD (GH-94433) 2022-07-01 21:48:38 +02:00
Christian Heimes bb8b931385
gh-90005: Port _ctypes to PY_STDLIB_MOD (GH-32229)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>

Automerge-Triggered-By: GH:tiran
2022-06-26 04:04:43 -07:00
Christian Heimes 3124d9a5aa
gh-93491: Add support tier detection to configure (GH-93492)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
2022-06-10 15:25:33 +02:00
Illia Volochii d1e2e0e1b2
gh-93475: Expose FICLONE and FICLONERANGE constants in fcntl (#93478) 2022-06-06 23:21:58 +02:00
Eric Snow caa279d6fd
bpo-40514: Drop EXPERIMENTAL_ISOLATED_SUBINTERPRETERS (gh-93185)
This was added for bpo-40514 (gh-84694) to test out a per-interpreter GIL. However, it has since proven unnecessary to keep the experiment in the repo. (It can be done as a branch in a fork like normal.) So here we are removing:

* the configure option
* the macro
* the code enabled by the macro
2022-05-27 17:38:01 -06:00
Kumar Aditya cb04a09d2d
GH-93207: Remove HAVE_STDARG_PROTOTYPES configure check for stdarg.h (#93215) 2022-05-27 13:30:45 +02:00
Victor Stinner 71d8775fee
gh-93202: Always use %zd printf formatter (#93201)
Python now always use the ``%zu`` and ``%zd`` printf formats to
format a size_t or Py_ssize_t number. Building Python 3.12 requires a
C11 compiler, so these printf formats are now always supported.

* PyObject_Print() and _PyObject_Dump() now use the printf %zd format
  to display an object reference count.
* Update PY_FORMAT_SIZE_T comment.
* Remove outdated notes about the %zd format in PyBytes_FromFormat()
  and PyUnicode_FromFormat() documentations.
* configure no longer checks for the %zd format and no longer defines
  PY_FORMAT_SIZE_T macro in pyconfig.h.
* pymacconfig.h no longer undefines PY_FORMAT_SIZE_T: macOS 10.4 is
  no longer supported. Python 3.12 now requires macOS 10.6 (Snow
  Leopard) or newer.
2022-05-25 14:21:36 +02:00
Soumendra Ganguly ae553b3561
bpo-41818: Add os.login_tty() for *nix. (#29658)
* Add `os.login_tty(fd)` for Unix.

Reviewed-by: Christian Heimes <christian@python.org>
Signed-off-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
2022-05-05 09:04:44 -07:00
Erlend Egeberg Aasland a7551247e7
bpo-41930: Add support for SQLite serialise/deserialise API (GH-26728)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-04-05 07:15:25 -07:00
Erlend Egeberg Aasland f1606a5ba5
bpo-45774: Harden SQLite detection (GH-30016) 2022-04-05 14:54:47 +02:00
Erlend Egeberg Aasland b36d222110
bpo-45847: Port _tkinter to PY_STDLIB_MOD (GH-31698)
- Remove ``--with-tclk-*`` options from `configure`
- Use pkg-config to detect `_tkinter` dependencies (Tcl/Tk, X11)
- Manual override via environment variables `TCLTK_CFLAGS` and `TCLTK_LIBS`
2022-03-31 03:19:08 -07:00
Christian Heimes b16b6bb8da
bpo-47095: Use libb2 to provide blake2 implementation (GH-32059) 2022-03-26 20:52:24 +01:00
Christian Heimes 4aea656d62
bpo-32033: Finalize WASI configure options (GH-32053) 2022-03-22 18:42:09 +01:00
Pablo Galindo Salgado 8e3fde728f
bpo-46968: Check for 'sys/auxv.h' in the configure script (GH-31961) 2022-03-18 05:03:22 -07:00
Oleksandr Pavlyk 3b128c0548
bpo-46968: Fix faulthandler for Sapphire Rapids Xeon (GH-31789)
In Linux kernel 5.14 one can dynamically request size of altstacksize
based on hardware capabilities with getauxval(AT_MINSIGSTKSZ).

This changes allows for Python extension's request to Linux kernel
to use AMX_TILE instruction set on Sapphire Rapids Xeon processor
to succeed, unblocking use of the ISA in frameworks.

Introduced HAVE_LINUX_AUXVEC_H in configure.ac and pyconfig.h.in
Used cpython_autoconf:269 docker container to generate configure.
2022-03-11 23:19:35 +01:00