Commit graph

1555 commits

Author SHA1 Message Date
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
Victor Stinner d9fd33a869
gh-112088: Run autoreconf in GHA check_generated_files (#112090)
The "Check if generated files are up to date" job of GitHub Actions
now runs the "autoreconf -ivf -Werror" command instead of the "make
regen-configure" command to avoid depending on the external quay.io
server.

Add Tools/build/regen-configure.sh script to regenerate the configure
with an Ubuntu container image. The
"quay.io/tiran/cpython_autoconf:271" container image
(https://github.com/tiran/cpython_autoconf) is no longer used.
2023-11-15 21:47:14 +01:00
Davide Rizzo d2f305dfd1
gh-111460: Restore ncurses widechar support on macOS (#111878) 2023-11-13 22:36:50 +09: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
Ayappan Perumal 88bac5d504
gh-110828: AIX 32bit build needs -latomic for _testcapi module (#110962) 2023-10-22 22:58:52 +02:00
YAMAMOTO Takashi 5dfa71769f
gh-111046: for wasi-threads, export memory as well via the linker (GH-111099) 2023-10-20 14:54:03 -07:00
Lysandros Nikolaou 01481f2dc1
gh-104169: Refactor tokenizer into lexer and wrappers (#110684)
* The lexer, which include the actual lexeme producing logic, goes into
  the `lexer` directory.
* The wrappers, one wrapper per input mode (file, string, utf-8, and
  readline), go into the `tokenizer` directory and include logic for
  creating a lexer instance and managing the buffer for different modes.
---------

Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2023-10-11 15:14:44 +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
Sam Gross 773614e03a
gh-109740: Use 't' in --disable-gil SOABI (#109922)
Shared libraries for CPython 3.13 are now marked with a 't' for
threading. For example, `binascii.cpython-313t-darwin.so`.
2023-09-27 15:24:12 +00:00
Sam Gross 0c89056fe5
gh-108724: Add PyMutex and _PyParkingLot APIs (gh-109344)
PyMutex is a one byte lock with fast, inlineable lock and unlock functions for the common uncontended case.  The design is based on WebKit's WTF::Lock.

PyMutex is built using the _PyParkingLot APIs, which provides a cross-platform futex-like API (based on WebKit's WTF::ParkingLot).  This internal API will be used for building other synchronization primitives used to implement PEP 703, such as one-time initialization and events.

This also includes tests and a mini benchmark in Tools/lockbench/lockbench.py to compare with the existing PyThread_type_lock.

Uncontended acquisition + release:
* Linux (x86-64): PyMutex: 11 ns, PyThread_type_lock: 44 ns
* macOS (arm64): PyMutex: 13 ns, PyThread_type_lock: 18 ns
* Windows (x86-64): PyMutex: 13 ns, PyThread_type_lock: 38 ns

PR Overview:

The primary purpose of this PR is to implement PyMutex, but there are a number of support pieces (described below).

* PyMutex:  A 1-byte lock that doesn't require memory allocation to initialize and is generally faster than the existing PyThread_type_lock.  The API is internal only for now.
* _PyParking_Lot:  A futex-like API based on the API of the same name in WebKit.  Used to implement PyMutex.
* _PyRawMutex:  A word sized lock used to implement _PyParking_Lot.
* PyEvent:  A one time event.  This was used a bunch in the "nogil" fork and is useful for testing the PyMutex implementation, so I've included it as part of the PR.
* pycore_llist.h:  Defines common operations on doubly-linked list.  Not strictly necessary (could do the list operations manually), but they come up frequently in the "nogil" fork. ( Similar to https://man.freebsd.org/cgi/man.cgi?queue)

---------

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2023-09-19 09:54:29 -06:00
Hood Chatham 6b179adb8c
gh-106213: Make Emscripten trampolines work with JSPI (GH-106219)
There is a WIP proposal to enable webassembly stack switching which have been
implemented in v8:

https://github.com/WebAssembly/js-promise-integration

It is not possible to switch stacks that contain JS frames so the Emscripten JS
trampolines that allow calling functions with the wrong number of arguments
don't work in this case. However, the js-promise-integration proposal requires
the [type reflection for Wasm/JS API](https://github.com/WebAssembly/js-types)
proposal, which allows us to actually count the number of arguments a function
expects.

For better compatibility with stack switching, this PR checks if type reflection
is available, and if so we use a switch block to decide the appropriate
signature. If type reflection is unavailable, we should use the current EMJS
trampoline.

We cache the function argument counts since when I didn't cache them performance
was negatively affected.

Co-authored-by: T. Wouters <thomas@python.org>
Co-authored-by: Brett Cannon <brett@python.org>
2023-09-15 15:04:21 -07:00
Victor Stinner 71b6e2602c
gh-109054: Don't use libatomic on cross-compilation (#109211)
configure no longer uses libatomic by default when Python is
cross-compiled. The LIBATOMIC variable can be set manually in this
case:

    ./configure LIBATOMIC="-latomic" (...)
2023-09-10 18:21:13 +02:00
Victor Stinner 1f7e42131d
gh-109054: configure checks if libatomic is needed (#109101)
Fix building the _testcapi extension on Linux AArch64 which requires
linking to libatomic when <cpython/pyatomic.h> is used: the
_Py_atomic_or_uint64() function requires libatomic
__atomic_fetch_or_8() on this platform.

The configure script now checks if linking to libatomic is needed and
generates a new LIBATOMIC variable used to build the _testcapi
extension.

Building the _testcapi extension now uses the LIBATOMIC variable in
its LDFLAGS, since Modules/_testcapi/pyatomic.c uses
<cpython/pyatomic.h>.

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-09-08 23:14:33 +02: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 aa52888e6a
gh-108777: Split _PyTime tests from _testinternalcapi.c (gh-108787) 2023-09-02 00:46:36 +00:00
Victor Stinner 13a00078b8
gh-108634: Py_TRACE_REFS uses a hash table (#108663)
Python built with "configure --with-trace-refs" (tracing references)
is now ABI compatible with Python release build and debug build.
Moreover, it now also supports the Limited API.

Change Py_TRACE_REFS build:

* Remove _PyObject_EXTRA_INIT macro.
* The PyObject structure no longer has two extra members (_ob_prev
  and _ob_next).
* Use a hash table (_Py_hashtable_t) to trace references (all
  objects): PyInterpreterState.object_state.refchain.
* Py_TRACE_REFS build is now ABI compatible with release build and
  debug build.
* Limited C API extensions can now be built with Py_TRACE_REFS:
  xxlimited, xxlimited_35, _testclinic_limited.
* No longer rename PyModule_Create2() and PyModule_FromDefAndSpec2()
  functions to PyModule_Create2TraceRefs() and
  PyModule_FromDefAndSpec2TraceRefs().
* _Py_PrintReferenceAddresses() is now called before
  finalize_interp_delete() which deletes the refchain hash table.
* test_tracemalloc find_trace() now also filters by size to ignore
  the memory allocated by _PyRefchain_Trace().

Test changes for Py_TRACE_REFS:

* Add test.support.Py_TRACE_REFS constant.
* Add test_sys.test_getobjects() to test sys.getobjects() function.
* test_exceptions skips test_recursion_normalizing_with_no_memory()
  and test_memory_error_in_PyErr_PrintEx() if Python is built with
  Py_TRACE_REFS.
* test_repl skips test_no_memory().
* test_capi skisp test_set_nomemory().
2023-08-31 18:33:34 +02:00
Victor Stinner bf08131e0a
gh-108494: Don't build _testclinic_limited with TraceRefs (#108608)
If Python is built with ./configure --with-trace-refs, don't build
the _testclinic_limited extension. The limited C API (Py_LIMITED_API)
is not compatible with Py_TRACE_REFS.
2023-08-29 13:39:42 +02:00
John Micco fecb9faf0b
gh-108465: Use compiler basename when determining compiler flags (#108392)
Note:
GNU Autoconf discourages the use of 'basename', and recommends 'expr' instead.

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-08-27 21:07:09 +00:00
Jeffery To c163d7f0b6
gh-95855: Refactor platform triplet detection code, add detection for MIPS soft float and musl libc (#107221)
- Move platform triplet detection code into Misc/platform_triplet.c
- Refactor MIPS detection, use defined(__mips64) to detect MIPS64
- Compute libc values in separate section
- Add detection for MIPS soft float
- Add detection for musl

musl supports SPE with its soft-float ABI:
https://git.musl-libc.org/cgit/musl/commit/?id=7be59733d71ada3a32a98622507399253f1d5e48

Original patch by Christian Heimes.

Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-08-24 14:22:50 +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
Lukas van de Wiel 9a6b278769
gh-106962: Detect mpicc in configure.ac (#106961)
Don't let autoconf mistake MPI compilers for Intel compilers;
filter out the MPI case to prevent Intel specific options from being applied.
2023-07-22 23:20:03 +00:00
Skip Montanaro 0345b0c2bb
gh-106123: Modules/_sha3 appears to no longer be necessary (#106124) 2023-06-26 20:40:34 -07:00
YAMAMOTO Takashi d8f87cdf94
gh-101538: Add experimental wasi-threads build (#101537)
Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-06-22 11:26:10 -07:00
Erlend E. Aasland 6849acb3fe
gh-105875: Require SQLite 3.15.2 or newer (#105876)
SQLite 3.15.2 was released 2016-11-28.
2023-06-19 00:29:08 +02:00
Erlend E. Aasland e01c4de35d
gh-90005: Don't link with libbsd if not needed (#105236)
The regression was introduced with commit 5b946cada.
Restore pre gh-29696 behaviour.
2023-06-06 09:33:01 +00: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
Erlend E. Aasland 2ea34cfb3a
gh-89886: Properly quote Autoconf macro arguments (#105062)
Autoconf 2.70 macros are picky about argument quotation.
2023-05-30 21:13:08 +00:00
Victor Stinner f66be6b11a
gh-104773: PEP 594: Remove the audioop module (#104937) 2023-05-25 17:59:00 +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 dbcdbf1814
gh-104773: Fix PY_STDLIB_MOD_SET_NA() on macOS (#104901)
The _scproxy is available on macOS: fix configure script.
2023-05-25 01:19:50 +02:00
Victor Stinner 17e1fe0f9b
gh-104773: PEP 594: Remove the nis module (#104897) 2023-05-25 00:08:36 +02:00
Victor Stinner 684e99d01d
gh-104773: PEP 594: Remove the spwd module (#104871)
Remove spwd from the configure script and Modules/Setup.
2023-05-24 20:34:41 +00:00
Victor Stinner bbc5e5c7d7
gh-104773: Remove OSSAUDIODEV_LIBS variable (#104864)
Update configure script for ossaudiodev removal: remove the
OSSAUDIODEV_LIBS variable.
2023-05-24 14:02:22 +00:00
Victor Stinner fc07fe4e37
gh-104773: PEP 594: Remove the ossaudiodev module (#104862)
* Remove ossaudiodev extension in configure.ac and regenerate
  the configure script.
* Remove ossaudiodev in Modules/Setup and Modules/Setup.stdlib.in.
2023-05-24 15:00:51 +02:00
Dong-hee Na c43785192c
gh-101282: Enclose BOLT_APPLY_FLAGS value in double quotes (gh-104752) 2023-05-24 19:10:46 +09:00
T. Wouters bc285c667c
Regenerate configure after the Python version bump (#104757)
Regenerate configure after the Python version bump.
2023-05-22 23:50:26 +02:00
Gregory Szorc 5360cb3d56
gh-101282: Apply BOLT optimizations to libpython for shared builds (#104709)
Apply BOLT optimizations to libpython for shared builds. Most of the C
code is in libpython so it is critical to apply BOLT there fully realize
BOLT benefits.

This change also reworks how BOLT instrumentation is applied. It
effectively removes the readelf based logic added in gh-101525 and
replaces it with a mechanism that saves a copy of the pre-bolt binary
and restores that copy when necessary. This allows us to perform BOLT
optimizations without having to manually delete the output binary to
force a new bolt run.

Also:
- add a clean-bolt target for purging BOLT files and hook that up to the
  clean target
- .gitignore BOLT related files

Before and after this refactor, `make` will no-op after a previous run.
Both versions should also share common make DAG deficiencies where
targets fail to trigger as often as they need to or can trigger
prematurely in certain scenarios. e.g. after this change you may need to
`rm profile-bolt-stamp` to force a BOLT run because there aren't
appropriate non-phony targets for BOLT's make target to depend on.

To make it easier to iterate on custom BOLT settings, the flags to pass
to instrumentation and application are now defined in configure and can
be overridden by passing BOLT_INSTRUMENT_FLAGS and BOLT_APPLY_FLAGS.
2023-05-22 13:45:20 +02:00
Erlend E. Aasland 146106a0f1
gh-104487: PYTHON_FOR_REGEN must be minimum Python 3.10 (#104488)
Also include Python 3.12 in the list of accepted versions.
2023-05-15 08:02:44 +00:00
Gregory Szorc 27d8ecd7f3
gh-101282: move BOLT config after PGO (gh-104493) 2023-05-15 04:29:44 +00:00
Zhang Na 03029ace92
gh-90656: Add platform triplets for 64-bit LoongArch (LA64) (#30939)
Signed-off-by: Zhang Na <zhangna@loongson.cn>
Co-authored-by: WANG Xuerui <git@xen0n.name>
2023-05-09 09:19:40 +00: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
Dong-hee Na 5d9762e7cf
gh-101525: Fix make test if the --enable-bolt enabled (gh-103574) 2023-04-17 23:14:18 +09:00
Nikita Sobolev 7f3c106503
gh-103326: Remove Python/importlib.h (GH-103331)
Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-04-12 11:27:14 -07:00
Matthias Görgens eff9f43924
gh-96821: Add config option --with-strict-overflow (#96823)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Shantanu <hauntsaninja@gmail.com>
2023-03-04 13:39:52 -08:00
Jonathan Protzenko fcadc7e405
gh-99108: Import MD5 and SHA1 from HACL* (#102089)
Replaces our fallback non-OpenSSL MD5 and SHA1 implementations with those from HACL* as we've already done with SHA2.
2023-02-22 13:18:43 -08:00
Eli Schwartz 226484e475
gh-99942: correct the pkg-config/python-config flags for cygwin/android 2023-02-16 17:57:59 +00:00
Gregory P. Smith 0b13575e74
gh-99108: Refactor _sha256 & _sha512 into _sha2. (#101924)
This merges their code. They're backed by the same single HACL* static library, having them be a single module simplifies maintenance.

This should unbreak the wasm enscripten builds that currently fail due to linking in --whole-archive mode and the HACL* library appearing twice.

Long unnoticed error fixed: _sha512.SHA384Type was doubly assigned and was actually SHA512Type. Nobody depends on those internal names.

Also rename LIBHACL_ make vars to LIBHACL_SHA2_ in preperation for other future HACL things.
2023-02-15 22:08:20 -08:00
Jonathan Protzenko e5da9ab2c8
gh-99108: Import SHA2-384/512 from HACL* (#101707)
Replace the builtin hashlib implementations of SHA2-384 and SHA2-512
originally from LibTomCrypt with formally verified, side-channel resistant
code from the [HACL*](https://github.com/hacl-star/hacl-star/) project.
The builtins remain a fallback only used when OpenSSL does not provide them.
2023-02-14 01:25:16 -08:00
Erlend E. Aasland 2db2c4b455
gh-92547: Purge sqlite3_enable_shared_cache() detection from configure (#101873) 2023-02-13 13:36:42 +01:00
Jonathan Protzenko 1fcc0efdaa
gh-99108: Replace SHA2-224 & 256 with verified code from HACL* (#99109)
replacing hashlib primitives (for the non-OpenSSL case) with verified implementations from HACL*. This is the first PR in the series, and focuses specifically on SHA2-256 and SHA2-224.

This PR imports Hacl_Streaming_SHA2 into the Python tree. This is the HACL* implementation of SHA2, which combines a core implementation of SHA2 along with a layer of buffer management that allows updating the digest with any number of bytes. This supersedes the previous implementation in the tree.

@franziskuskiefer was kind enough to benchmark the changes: in addition to being verified (thus providing significant safety and security improvements), this implementation also provides a sizeable performance boost!

```
---------------------------------------------------------------
Benchmark                     Time             CPU   Iterations
---------------------------------------------------------------
Sha2_256_Streaming            3163 ns      3160 ns       219353     // this PR
LibTomCrypt_Sha2_256          5057 ns      5056 ns       136234     // library used by Python currently
``` 

The changes in this PR are as follows:
- import the subset of HACL* that covers SHA2-256/224 into `Modules/_hacl`
- rewire sha256module.c to use the HACL* implementation

Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-02-06 18:11:01 -08:00
Eric Snow c67b00534a
gh-101524: Split Up the _xxsubinterpreters Module (gh-101526)
This is step 1 in potentially dropping all the "channel"-related code. Channels have already been removed from PEP 554.

https://github.com/python/cpython/issues/101524
2023-02-03 18:14:43 -07:00
Dong-hee Na a958e7d35a
gh-101278: Drop -gdwarf-4 flag from the BOLT build (gh-101280) 2023-01-24 19:22:00 +09:00
Gregory Szorc 7589d713a1
gh-101060: conditionally add -fno-reorder-blocks-and-partition (gh-101061) 2023-01-24 18:34:44 +09:00
Gregory Szorc 79af40a403
gh-101047: Remove vestigial references to macOS libtool options (gh-101048)
LIBTOOL_CRUFT and OTHER_LIBTOOL_OPT variables have been unused since commit
19199830f7 in 2011.
2023-01-22 17:26:42 -05:00
Kushal Das 75c8133efe
gh-100340: Allows -Wno-int-conversion for wasm (#100341)
Fixes #100340 allows -Wno-int-conversion for wasm
2023-01-18 19:43:49 +01:00
Michał Górny 02a72f080d
gh-98636: Fix detecting gdbm_compat for _dbm module (#98643)
Fix the gdbm_compat library detection logic to actually check for
-lgdbm_compat independently of the ndbm detection.
This fixes the build failure with `--with-dbmliborder=gdbm`,
and implicit fallback to ndbm with the default value.
2023-01-11 22:46:28 +01:00
Dustin Spicuzza cc8748712e
gh-86082: bpo-41916: allow cross-compiled python to have -pthread set for CXX (#22525)
When cross-compiling, the compile/run test for -pthread always fails so -pthread
will never be automatically set without an override from the cache. ac_cv_pthread
can already be overridden, so do the same thing for ac_cv_cxx_thread.
2023-01-05 14:57:31 -08:00
Zachary Ware 2df82db485
gh-100540: Remove obsolete Modules/_ctypes/darwin/ dlfcn shim (GH-100541)
As far as I can tell, this hasn't been actually used since Mac OS X 10.2.
2022-12-29 16:13:28 -06:00
Zachary Ware 25590eb5de
gh-100540: Remove obsolete '--with-system-ffi' configure option (GH-100544)
It has had no effect on non-macOS platforms for a long time, and has had
the non-obvious effect of invoking `pkg_config` and not setting
`-DUSING_APPLE_OS_LIBFFI` on macOS since GH-22855.
2022-12-28 13:36:03 -06:00
Zachary Ware fd4b55ff17
gh-100540: Remove unnecessary '-DMACOSX' for ctypes on macOS (GH-100542)
The define was only used to protect a `#pragma clang diagnostic`
setting, which is already better guarded by `__clang__` anwyay.
2022-12-28 12:06:58 -06:00
Sam James e35ca417fe
gh-99086: Fix -Wstrict-prototypes, -Wimplicit-function-declaration warnings in configure.ac (#99406)
Follow up to 12078e78f6.
2022-11-26 18:38:49 +05:30
colorfulappl c450c8c9ed
gh-96002: Add functional test for Argument Clinic (#96178)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2022-11-21 15:08:45 +01:00
Miro Hrončok 6abec1caff
gh-98707: configure --with-system-libmpdec and --with-system-expat no longer include vendored headers (#98711) 2022-11-11 19:59:30 +01: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
Sam James 12078e78f6
gh-99086: Fix implicit int compiler warning in configure check for PTHREAD_SCOPE_SYSTEM (#99085) 2022-11-05 09:30:31 +01:00
serge-sans-paille 8c4de57de9
gh-98948: Remove obsolete readelf dependency (#98949)
This got introduced in commit 5884449539
to determine if readline is already linked against curses or tinfo in
the setup.py, which is no longer present.
2022-11-03 14:31:37 +01:00
Jelle Zijlstra f7241aaf6f
gh-98989: configure: add 3.11 to list of Pythons (#98988)
Closes #98989

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2022-11-02 10:05:42 -07:00
Pablo Galindo Salgado 1f737edb67
gh-96143: Move the perf trampoline files to the Python directory (#98675) 2022-10-25 23:34:22 +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
Dong-hee Na 83d84e67cd
gh-96761: Fix build process of the clang compiler for _bootstrap_python (gh-96945)
Co-authored-by: Matthias Goergens <matthias.goergens@gmail.com>
2022-09-23 11:00:44 +09:00
Dong-hee Na e47b96c44f
gh-89536: Use ThinLTO policy if possible (gh-96766) 2022-09-16 19:40:05 +09:00
Christian Heimes a36235d5c7
gh-84461: Omit resource mod and getresuid funcs on Emscripten (GH-96303) 2022-09-11 10:10:00 +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
Dong-hee Na af368a7db4
gh-96191: Update the configure file to use GitHub issue (gh-96211) 2022-08-29 14:01:37 +09:00
Pablo Galindo Salgado 5b070c0d40
gh-95973: Add a new --with-dsymutil option to link debug information in macOS (GH-95974)
Automerge-Triggered-By: GH:pablogsal
2022-08-26 17:49:41 -07:00
Christian Heimes 6087f491ea
gh-95853: WASM: better version and asset handling in scripts (GH-96045)
- support EMSDK tot-upstream and git releases
- allow WASM assents for wasm64-emscripten and WASI. This makes single file distributions on WASI easier.
- decouple WASM assets from browser builds
2022-08-19 08:36:12 +02:00
Kevin Modzelewski 214eb2cce5
gh-90536: Add support for the BOLT post-link binary optimizer (gh-95908)
* Add support for the BOLT post-link binary optimizer

Using [bolt](https://github.com/llvm/llvm-project/tree/main/bolt)
provides a fairly large speedup without any code or functionality
changes. It provides roughly a 1% speedup on pyperformance, and a
4% improvement on the Pyston web macrobenchmarks.

It is gated behind an `--enable-bolt` configure arg because not all
toolchains and environments are supported. It has been tested on a
Linux x86_64 toolchain, using llvm-bolt built from the LLVM 14.0.6
sources (their binary distribution of this version did not include bolt).

Compared to [a previous attempt](https://github.com/faster-cpython/ideas/issues/224),
this commit uses bolt's preferred "instrumentation" approach, as well as adds some non-PIE
flags which enable much better optimizations from bolt.

The effects of this change are a bit more dependent on CPU microarchitecture
than other changes, since it optimizes i-cache behavior which seems
to be a bit more variable between architectures. The 1%/4% numbers
were collected on an Intel Skylake CPU, and on an AMD Zen 3 CPU I
got a slightly larger speedup (2%/4%), and on a c6i.xlarge EC2 instance
I got a slightly lower speedup (1%/3%).

The low speedup on pyperformance is not entirely unexpected, because
BOLT improves i-cache behavior, and the benchmarks in the pyperformance
suite are small and tend to fit in i-cache.

This change uses the existing pgo profiling task (`python -m test --pgo`),
though I was able to measure about a 1% macrobenchmark improvement by
using the macrobenchmarks as the training task. I personally think that
both the PGO and BOLT tasks should be updated to use macrobenchmarks,
but for the sake of splitting up the work this PR uses the existing pgo task.

* Simplify the build flags

* Add a NEWS entry

* Update Makefile.pre.in

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>

* Update configure.ac

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>

* Add myself to ACKS

* Add docs

* Other review comments

* fix tab/space issue

* Make it more clear that --enable-bolt is experimental

* Add link to bolt's github page

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2022-08-19 06:33:54 +09:00
Christian Heimes 32ac98e899
gh-95853: Add script to automate WASM build (GH-95828)
Automate WASM build with a new Python script. The script provides
several build profiles with configure flags for Emscripten flavors
and WASI. The script can detect and use Emscripten SDK and WASI SDK from
default locations or env vars.

``configure`` now detects Node arguments and creates HOSTRUNNER
arguments for Node 16. It also sets correct arguments for
``wasm64-emscripten``.

Co-authored-by: Brett Cannon <brett@python.org>
2022-08-13 21:56:08 +02:00
Victor Stinner 398ed84dc4
gh-93744: Remove configure --with-cxx-main option (#95651)
Remove the "configure --with-cxx-main" build option: it didn't work
for many years. Remove the MAINCC variable from configure and
Makefile.

The MAINCC variable was added by the issue gh-42471: commit
0f48d98b74. Previously, --with-cxx-main
was named --with-cxx.

Keep CXX and LDCXXSHARED variables, even if they are no longer used
by Python build system.
2022-08-05 13:26:58 +02: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 daa64d6a59
gh-95085: Promote Emscripten and WASI to PEP 11 tier 3 (GH-95086) 2022-07-27 08:18:34 +02:00
Christian Heimes 9af7f87d76
gh-94801: Fix regression in configure's CPPFLAGS handling (GH-95288) 2022-07-26 21:39:04 +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 97b4121f93
gh-94847: Don't force inlining in debug builds of libmpdec (GH-94848) 2022-07-18 08:47:03 +02:00
Christian Heimes 944ff8c57c
gh-94801: Use custom flags to check for headers and libs (#94802) 2022-07-15 14:48:01 +02:00
Christian Heimes 81dca70d70
gh-93939: Build C extensions without setup.py (GH-94474)
Combines GH-93940, GH-94452, and GH-94433
2022-07-14 00:51:49 -07:00
Christian Heimes 18ef240a2c
gh-93649: Fix dependencies of _testcapi (#94695)
- header files are located in $(srcdir)
- dependencies must not list C files that are also in a makesetup Setup file
- generate SRCDIRS for OOT builds
2022-07-09 13:01:23 +02:00
Christian Heimes 29f86d6c28
gh-94642: Remove -D_XOPEN_SOURCE from more pkg-config CFLAGS (#94657)
Some pkg-config pc files define CFLAGS with -D_XOPEN_SOURCE=600. We always want _XOPEN_SOURCE=700.
2022-07-07 14:47:32 +02:00
Christian Heimes 9c60b25a0d
gh-94644: Define HAVE_NCURSESW in pkg-config branch (#94651) 2022-07-07 12:57:12 +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 d6acdc1b60
gh-90005-ffi: Fix building _ctypes without pkg-config (GH-94451)
The fallback path did not set LIBFFI_LIBS variable to link with ``-lffi``.
2022-07-01 09:23:41 +02:00