Commit graph

1018 commits

Author SHA1 Message Date
Brandt Bucher 1b34b5687b
gh-91404: Use computed gotos and reduce indirection in re (#91495) 2022-04-15 09:26:44 -07:00
Christian Heimes 7acedd71de
gh-84461: Drop -sWASM, fix building tests for browser (GH-91530)
- drop unnecessary ``=1`` suffix from Emscripten flags
- drop unnecessary ``-sWASM`` flag for side modules
- rename ``build_platform`` to ``build_wasm``. I introduced the target
  for WASM builds a couple of months ago.
- fix ``--enable-test-modules`` for browser builds
2022-04-14 16:27:41 +02:00
Serhiy Storchaka 474fdbe9e4
bpo-47152: Automatically regenerate sre_constants.h (GH-91439)
* Move the code for generating Modules/_sre/sre_constants.h from
  Lib/re/_constants.py into a separate script
  Tools/scripts/generate_sre_constants.py.
* Add target `regen-sre` in the makefile.
* Make target `regen-all` depending on `regen-sre`.
2022-04-12 18:34:06 +03:00
Christian Heimes defbbd68f7
bpo-40280: WASM docs and smaller browser builds (GH-32412)
Co-authored-by: Brett Cannon <brett@python.org>
2022-04-10 09:29:51 +02:00
Victor Stinner 85addfb9c6
bpo-35134: Remove the Include/code.h header file (GH-32385)
Remove the Include/code.h header file. C extensions should only
include the main <Python.h> header file.

Python.h includes directly Include/cpython/code.h instead.
2022-04-07 02:29:52 +02:00
Victor Stinner 5c4d1f6e0e
bpo-35134: Add Include/cpython/setobject.h header (GH-32384) 2022-04-07 01:26:24 +02:00
Victor Stinner ca219f6dfc
bpo-35134: Add Include/cpython/complexobject.h header (GH-32383)
Move the private _PyComplex_FormatAdvancedWriter() function to the
internal C API. This function is no longer exported.
2022-04-07 01:05:27 +02:00
Christian Heimes 96e09837fb
bpo-40280: Add limited Emscripten REPL (GH-32284)
Co-authored-by: Katie Bell <katie@katharos.id.au>
2022-04-05 11:21:11 +02:00
Ronald Oussoren 6aaf4cd866
bpo-46890: Fix setting of sys._base_executable with framework builds on macOS (GH-31958)
The side effect of this bug was that venv environments directly
used the main interpreter instead of the intermediate stub executable,
which can cause problems when a script uses system APIs that
require the use of an application bundle.
2022-04-05 02:05:36 -04:00
Serhiy Storchaka 1578f06c1c
bpo-47152: Move sources of the _sre module into a subdirectory (GH-32290) 2022-04-04 10:53:26 +03:00
Hood Chatham 087d0fa5b9
bpo-47176: Interrupt handling for wasm32-emscripten builds without pthreads (GH-32209)
Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Brett Cannon <brett@python.org>
2022-04-03 22:58:52 +02:00
Serhiy Storchaka 1be3260a90
bpo-47152: Convert the re module into a package (GH-32177)
The sre_* modules are now deprecated.
2022-04-02 11:35:13 +03:00
Eric Snow e7bb7c2f04
bpo-47146: Stop Depending On regen-deepfreeze For regen-global-objects (gh-32218)
This effectively reverts the Makefile change in gh-31637. I've added some notes so it is more clear what is going on.

We also update the "Check if generated files are up to date" job to run "make regen-deepfreeze" to ensure "make regen-global-objects" catches deepfreeze.c.

https://bugs.python.org/issue47146
2022-03-31 14:29:52 -06: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
Eric Snow db4dada510
bpo-47146: Avoid Using make Recursively (gh-32206)
https://bugs.python.org/issue47146
2022-03-30 19:24:02 -06:00
Eric Snow 4c116f716b
bpo-47146: Eliminate a race between make regen-deepfreeze and make regen-global-objects. (gh-32162)
The race likely originated with gh-32061.

https://bugs.python.org/issue47146
2022-03-28 14:56:05 -06:00
Christian Heimes 5fd8c574e0
bpo-47098: Replace Keccak Code Package with tiny_sha3 (GH-32060) 2022-03-26 21:36:08 +01:00
Christian Heimes b16b6bb8da
bpo-47095: Use libb2 to provide blake2 implementation (GH-32059) 2022-03-26 20:52:24 +01:00
Eric Snow febf54bcf3
bpo-46712: Do not Regen Deep-Frozen Modules before Generating Global Objects (gh-32061)
We have to run "make regen-deepfreeze" before running Tools/scripts/generate-global-objects.py; otherwise we will miss any changes to global objects in deep-frozen modules (which aren't committed in the repo).  However, building $(PYTHON_FOR_FREEZE) fails if one of its source files had a global object (e.g. via _Py_ID(...)) added or removed, without generate-global-objects.py running first.  So "make regen-global-objects" would sometimes fail.

We solve this by running generate-global-objects.py before *and* after "make regen-deepfreeze". To speed things up and cut down on noise, we also avoid updating the global objects files if there are no changes to them.

https://bugs.python.org/issue46712
2022-03-23 09:55:52 -06:00
Christian Heimes deeaac49e2
bpo-40280: Skip socket, fork, subprocess tests on Emscripten (GH-31986)
- Add requires_fork and requires_subprocess to more tests
- Skip extension import tests if dlopen is not available
- Don't assume that _testcapi is a shared extension
- Skip a lot of socket tests that don't work on Emscripten
- Skip mmap tests, mmap emulation is incomplete
- venv does not work yet
- Cannot get libc from executable

The "entire" test suite is now passing on Emscripten with EMSDK from git head (91 suites are skipped).
2022-03-22 03:04:36 -07:00
Christian Heimes 434ffb7f1f
bpo-46973: Add regen-configure make target (GH-31792) 2022-03-10 18:03:27 +01:00
Dominic Davis-Foster 23dcea5de7
bpo-40059: Fix installation of tomllib (GH-31784) 2022-03-09 05:38:00 -08:00
Erlend Egeberg Aasland 47cca0492b
bpo-46933: Fix make distclean regression (GH-31737) 2022-03-07 23:18:54 +01:00
Christian Heimes ca9689f8da
bpo-46933: Make pwd module optional (GH-31700)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
2022-03-07 13:36:47 +01:00
Eric Snow 21099fc064
bpo-46712: Let generate_global_objects.py Run on Earlier Python Versions (gh-31637)
https://bugs.python.org/issue46712
2022-03-01 14:29:54 -07:00
Victor Stinner ec091bd47e
bpo-45459: Add pytypedefs.h header file (GH-31527)
Move forward declarations of Python C API types to a new pytypedefs.h
header file to solve interdependency issues between header files.

pytypedefs.h contains forward declarations of the following types:

* PyCodeObject
* PyFrameObject
* PyGetSetDef
* PyInterpreterState
* PyLongObject
* PyMemberDef
* PyMethodDef
* PyModuleDef
* PyObject
* PyThreadState
* PyTypeObject
2022-02-24 17:07:12 +01:00
Victor Stinner 66b3cd7063
bpo-45459: Rename buffer.h to pybuffer.h (#31201)
Rename Include/buffer.h header file to Include/pybuffer.h to avoid
conflicts with projects having an existing "buffer.h" header file.

* Incude pybuffer.h before object.h in Python.h.
* Remove #include "buffer.h" from Include/cpython/object.h.
* Add a forward declaration of the PyObject type in pybuffer.h to fix
  an inter-dependency issue.
2022-02-22 23:11:48 +01:00
Eric Snow 6c89589486
bpo-46541: Drop the check for orphaned global strings. (gh-31363)
https://bugs.python.org/issue46541
2022-02-15 20:06:38 -07:00
Eric Snow 1d9036425e
Regen the global objects using PYTHON_FOR_REGEN. (gh-31344)
https://bugs.python.org/issue46541
2022-02-14 16:07:09 -07:00
Eric Snow 81c72044a1
bpo-46541: Replace core use of _Py_IDENTIFIER() with statically initialized global objects. (gh-30928)
We're no longer using _Py_IDENTIFIER() (or _Py_static_string()) in any core CPython code.  It is still used in a number of non-builtin stdlib modules.

The replacement is: PyUnicodeObject (not pointer) fields under _PyRuntimeState, statically initialized as part of _PyRuntime.  A new _Py_GET_GLOBAL_IDENTIFIER() macro facilitates lookup of the fields (along with _Py_GET_GLOBAL_STRING() for non-identifier strings).

https://bugs.python.org/issue46541#msg411799 explains the rationale for this change.

The core of the change is in:

* (new) Include/internal/pycore_global_strings.h - the declarations for the global strings, along with the macros
* Include/internal/pycore_runtime_init.h - added the static initializers for the global strings
* Include/internal/pycore_global_objects.h - where the struct in pycore_global_strings.h is hooked into _PyRuntimeState
* Tools/scripts/generate_global_objects.py - added generation of the global string declarations and static initializers

I've also added a --check flag to generate_global_objects.py (along with make check-global-objects) to check for unused global strings.  That check is added to the PR CI config.

The remainder of this change updates the core code to use _Py_GET_GLOBAL_IDENTIFIER() instead of _Py_IDENTIFIER() and the related _Py*Id functions (likewise for _Py_GET_GLOBAL_STRING() instead of _Py_static_string()).  This includes adding a few functions where there wasn't already an alternative to _Py*Id(), replacing the _Py_Identifier * parameter with PyObject *.

The following are not changed (yet):

* stop using _Py_IDENTIFIER() in the stdlib modules
* (maybe) get rid of _Py_IDENTIFIER(), etc. entirely -- this may not be doable as at least one package on PyPI using this (private) API
* (maybe) intern the strings during runtime init

https://bugs.python.org/issue46541
2022-02-08 13:39:07 -07:00
Christian Heimes f66c857572
bpo-45459: Add Py_buffer to limited API (GH-29991)
- [x] ``Py_buffer`` struct
- [x] ``PyBuffer_*()`` API functions
- [x] ``PyBUF_*`` constants
- [x] ``Py_bf_getbuffer`` and ``Py_bf_releasebuffer`` type slots
- [x] ``PyMemoryView_FromBuffer()`` API
- [x] tests for limited API
- [x] ``make regen-limited-abi``
- [x] documentation update
- [ ] export ``PyPickleBuffer*()`` API ???
2022-02-02 07:03:10 -08:00
Eric Snow 247480a21c
bpo-46541: Generate the global objects initializer. (gh-30941)
This change is a prerequisite for generating code for other global objects (like strings in gh-30928).

(We borrowed some code from Tools/scripts/deepfreeze.py.)

https://bugs.python.org/issue46541
2022-01-27 11:06:09 -07:00
Victor Stinner 13194084b4
make regen-all now suggests running: make autoconf (GH-30893)
"make autoconf" also runs autoheader, whereas "autoconf" does not.
2022-01-27 00:35:40 +01:00
Victor Stinner d4a85f104b
bpo-35134: Add Include/cpython/descrobject.h (GH-30923)
Move Include/descrobject.h non-limited API to a new
Include/cpython/descrobject.h header file.
2022-01-26 17:32:47 +01:00
Kumar Aditya ef3ef6fa43
bpo-46429: Merge all deepfrozen files into one (GH-30572) 2022-01-20 08:38:39 -08:00
Christian Heimes c8319f7921
bpo-40280: Build WASM stdlib bundle and more modules for node (GH-30597) 2022-01-14 12:11:49 +01:00
Eric Snow bc02eac9d2
bpo-46370: Move the static initializer for _PyRuntime to its own header file. (gh-30587)
https://bugs.python.org/issue46370
2022-01-13 15:54:36 -07:00
Victor Stinner 6be848922b
bpo-44133: Link Python executable with object files (GH-30556)
When Python is built without --enable-shared, the "python" program is
now linked to object files, rather than being linked to the Python
library (libpython.a), to make sure that all symbols are exported.
Previously, the linker omitted some symbols like the Py_FrozenMain()
function.

When Python is configured with --without-static-libpython, the Python
static library (libpython.a) is no longer built.

* Check --without-static-libpython earlier in configure.ac
* Add LINK_PYTHON_OBJS and LINK_PYTHON_DEPS variables to Makefile.
* test_capi now ensures that the "Py_FrozenMain" symbol is exported.
2022-01-13 19:24:28 +01:00
Christian Heimes 43839ba438
bpo-40280: Add --with-emscripten-target to build for browser or node (GH-30552)
Co-authored-by: Ethan Smith <ethan@ethanhs.me>
2022-01-12 16:08:19 +01:00
Jason R. Coombs 35628e4cde
bpo-46118: Make sure importlib.resources is included. (GH-30311) 2021-12-30 22:39:24 -05:00
Christian Heimes 0339434835
bpo-40280: Add Tools/wasm with helpers for cross building (GH-29984)
Co-authored-by: Ethan Smith <ethan@ethanhs.me>
Co-authored-by: Brett Cannon <brett@python.org>
2021-12-18 15:54:02 +01:00
Eric Snow 121f1f893a
bpo-45953: Statically initialize the small ints. (gh-30092)
The array of small PyLong objects has been statically declared. Here I also statically initialize them. Consequently they are no longer initialized dynamically during runtime init.

I've also moved them under a new sub-struct in _PyRuntimeState, in preparation for static allocation and initialization of other global objects.

https://bugs.python.org/issue45953
2021-12-13 18:04:05 -07:00
Christian Heimes eb483c46d6
bpo-45949: Pure Python freeze module for cross builds (GH-29899) 2021-12-13 20:48:46 +01:00
Christian Heimes 16638a4bdb
bpo-45654: No need to freeze types (GH-30028) 2021-12-10 19:09:09 +01:00
Eric Snow c8749b5783
bpo-46008: Make runtime-global object/type lifecycle functions and state consistent. (gh-29998)
This change is strictly renames and moving code around.  It helps in the following ways:

* ensures type-related init functions focus strictly on one of the three aspects (state, objects, types)
* passes in PyInterpreterState * to all those functions, simplifying work on moving types/objects/state to the interpreter
* consistent naming conventions help make what's going on more clear
* keeping API related to a type in the corresponding header file makes it more obvious where to look for it

https://bugs.python.org/issue46008
2021-12-09 12:59:26 -07:00
Kumar Aditya 44b0e76f2a
bpo-45654: Freeze the runpy module and stuff it imports (GH-29903) 2021-12-09 08:51:09 -08:00
Christian Heimes 06c4ae8b13
bpo-45582: Fix framework path and bootstrap build (GH-29954)
* Check NS API return values for NULL to prevent segfault in
  ``_bootstrap_python``.
* Set modPathInitialized to 1 so the ``decode_to_dict`` path is used.

Signed-off-by: Christian Heimes <christian@python.org>
2021-12-07 19:09:53 +01:00
Christian Heimes 612e59b53f
bpo-45950: Fix macOS framework builds of _bootstrap_python (GH-29936) 2021-12-06 17:13:53 +01:00
Christian Heimes 84ca1232b0
bpo-45950: Introduce Bootstrap Python again (#29859)
The build system now uses a :program:`_bootstrap_python` interpreter for
freezing and deepfreezing again. To speed up build process the build tools
:program:`_bootstrap_python` and :program:`_freeze_module` are no longer
build with LTO.

Cross building depends on a build Python interpreter, which must have same
version and bytecode as target host Python.
2021-12-03 16:01:11 +01:00
Christian Heimes ccb73a0d50
bpo-45582: Fix out-of-tree build issues with new getpath (GH-29902) 2021-12-03 14:47:06 +01:00
Steve Dower 99fcf15052
bpo-45582: Port getpath[p].c to Python (GH-29041)
The getpath.py file is frozen at build time and executed as code over a namespace. It is never imported, nor is it meant to be importable or reusable. However, it should be easier to read, modify, and patch than the previous code.

This commit attempts to preserve every previously tested quirk, but these may be changed in the future to better align platforms.
2021-12-03 00:08:42 +00:00
Christian Heimes 992565f7f7
bpo-45881: configure --with-freeze-module --with-build-python (GH-29835)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
Co-authored-by: Ethan Smith <ethan@ethanhs.me>
2021-11-29 17:23:29 +01:00
Christian Heimes 765b2a3ad2
bpo-45886: Fix OOT build when srcdir has frozen module headers (GH-29793)
The presence of frozen module headers in srcdir interfers with OOT
build. Make considers headers in srcdir up to date, but later builds do
not use VPATH to locate files. make clean now removes the headers, too.

Also remove stale ``_bootstrap_python`` from .gitignore.
2021-11-26 17:05:16 +01:00
Christian Heimes d224e769b8
bpo-40280: clean and ignore .wasm files (GH-29794) 2021-11-26 14:29:46 +01:00
Christian Heimes dfcc6ff36f
bpo-33393: Update config.guess and config.sub (GH-29781) 2021-11-25 20:55:29 +01:00
Christian Heimes dd8ce9ea8d
bpo-45886: Allow overriding freeze command for cross compiling (GH-29735) 2021-11-24 08:07:15 +01:00
Guido van Rossum 5be98e57b3
bpo-45873: Get rid of bootstrap_python (#29717)
Instead we use $(PYTHON_FOR_REGEN) .../deepfreeze.py with the
frozen .h file as input, as we did for Windows in bpo-45850.

We also get rid of the code that generates the .h files
when make regen-frozen is run (i.e., .../make_frozen.py),
and the MANIFEST file.

Restore Python 3.8 and 3.9 as Windows host Python again

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2021-11-23 08:56:06 -08:00
Mark Shannon 135cabd328
bpo-44525: Copy free variables in bytecode to allow calls to inner functions to be specialized (GH-29595)
* Make internal APIs that take PyFrameConstructor take a PyFunctionObject instead.

* Add reference to function to frame, borrow references to builtins and globals.

* Add COPY_FREE_VARS instruction to allow specialization of calls to inner functions.
2021-11-23 09:53:24 +00:00
Neil Schemenauer 457e6a6e96
bpo-45561: Run smelly.py tool from $(srcdir) (GH-29138) 2021-11-23 08:51:02 +01:00
Christian Heimes 512dbf6f56
Fix out-of-tree build support for multissltest (GH-29694) 2021-11-22 10:50:53 +01:00
Pablo Galindo Salgado c9c4444d9f
Refactor parser compilation units into specific components (GH-29676) 2021-11-21 01:08:50 +00:00
Christian Heimes f36c69a26e
bpo-45847: Port test modules to PY_STDLIB_MOD (GH-29660) 2021-11-20 16:43:10 +01:00
Christian Heimes 7e44dc0ba7
bpo-45573: Move mandatory core modules to Modules/Setup.bootstrap (GH-29616) 2021-11-19 16:40:57 +01:00
Erlend Egeberg Aasland 29e5874d5a
bpo-45774: Autoconfiscate SQLite detection (GH-29507)
Co-authored-by: Christian Heimes <christian@python.org>
2021-11-19 15:10:41 +01:00
Christian Heimes e4bb22fabb
bpo-45573: Add Modules/Setup.stdlib with conditional modules (GH-29615) 2021-11-18 14:40:01 +01:00
Christian Heimes 25ecc040d0
bpo-45573: Introduce extension module flags in Makefile (GH-29594)
``configure`` now uses a standardized format to forward state, compiler
flags, and linker flags to ``Makefile``, ``setup.py``, and
``Modules/Setup``. ``makesetup`` use the new variables by default if a
module line does not contain any compiler or linker flags. ``setup.py``
has a new function ``addext()``.

For a module ``egg``, configure adds:

* ``MODULE_EGG`` with value yes, missing, disabled, or n/a
* ``MODULE_EGG_CFLAGS``
* ``MODULE_EGG_LDFLAGS``

``Makefile.pre.in`` may also provide ``MODULE_EGG_DEPS`` that lists
dependencies such as header files and static libs.

Signed-off-by: Christian Heimes <christian@python.org>
2021-11-18 09:18:44 +01:00
Christian Heimes c3997865f2
bpo-45573: Use Makefile's dependencies in setup.py (GH-29559) 2021-11-14 20:55:15 +01:00
Christian Heimes 464e6616be
bpo-45800: Move pyexpat build setup into configure (GH-29547)
Settings for :mod:`pyexpat` C extension are now detected by ``configure``.
The bundled ``expat`` library is built in ``Makefile``.

Signed-off-by: Christian Heimes <christian@python.org>
2021-11-14 10:02:24 +01:00
Christian Heimes 0486570f7b
bpo-45798: Move _decimal build setup into configure (GH-29541)
Settings for :mod:`decimal` internal C extension are now detected by
:program:`configure`. The bundled `libmpdec` library is built in
``Makefile``.

Signed-off-by: Christian Heimes <christian@python.org>
2021-11-13 13:56:16 +01:00
Guido van Rossum 1cbaa505d0
bpo-45696: Deep-freeze selected modules (GH-29118)
This gains 10% or more in startup time for `python -c pass` on UNIX-ish systems.

The Makefile.pre.in generating code builds on Eric's work for bpo-45020, but the .c file generator is new.

Windows version TBD.
2021-11-10 18:01:53 -08:00
Filipe Laíns 38982ab136
makefile: remove unused SGI_ABI variable (GH-29325)
SGI_ABI support was removed in [1] but this variable was never removed
from the makefile. Currently, it is just a bad variable that does not
get replaced by the configure script.

[1] https://github.com/python/cpython/pull/3294

Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-11-02 21:39:27 +01:00
Erlend Egeberg Aasland 62bf263a77
bpo-10572: Move sqlite3 tests to Lib/test (GH-29304)
Automerge-Triggered-By: GH:brettcannon
2021-10-29 15:08:19 -07:00
Christian Heimes f0150ac94a
bpo-45548: Some test modules must be built as shared libs (GH-29268)
Some test cases don't work when test modules are static extensions.

Add dependency on Modules/config.c to trigger a rebuild whenever a
module build type is changed.

``makesetup`` puts shared extensions into ``Modules/`` directory. Create
symlinks from pybuilddir so the extensions can be imported.

Note: It is not possible to use the content of pybuilddir.txt as a build
target. Makefile evaluates target variables in the first pass. The
pybuilddir.txt file does not exist at that point.
2021-10-29 17:49:57 +02:00
Christian Heimes b5ee79494b
bpo-45548: makesetup improvements (GH-29225)
* record which modules are build as shared extensions
* put object files in same directory as source files
* remove dependency on deleted _math.c

Signed-off-by: Christian Heimes <christian@python.org>
2021-10-26 10:58:43 +02:00
Christian Heimes 81669d1b7b
bpo-45595: Make extensions depend on header files (GH-29198)
``setup.py`` and ``makesetup`` now track build dependencies on all Python
header files and module specific header files.

Signed-off-by: Christian Heimes <christian@python.org>
2021-10-25 20:01:03 +02:00
Christian Heimes fa26245a1c
bpo-45548: Remove _math.c workarounds for pre-C99 libm (GH-29179)
The :mod:`math` and :mod:`cmath` implementation now require a C99 compatible
``libm`` and no longer ship with workarounds for missing acosh, asinh,
expm1, and log1p functions.

The changeset also removes ``_math.c`` and moves the last remaining
workaround into ``_math.h``. This simplifies static builds with
``Modules/Setup`` and resolves symbol conflicts.

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
Co-authored-by: Brett Cannon <brett@python.org>
Signed-off-by: Christian Heimes <christian@python.org>
2021-10-25 01:25:27 -07:00
Victor Stinner 5f09bb021a
bpo-35134: Add Include/cpython/longobject.h (GH-29044)
Move Include/longobject.h non-limited API to a new
Include/cpython/longobject.h header file.

Move the following definitions to the internal C API:

* _PyLong_DigitValue
* _PyLong_FormatAdvancedWriter()
* _PyLong_FormatWriter()
2021-10-19 02:04:52 +02:00
Victor Stinner aad88d33d9
bpo-35134: Split warnings.h and weakrefobject.h (GH-29042)
Split header files to move the non-limited API to Include/cpython/:

* Include/warnings.h => Include/cpython/warnings.h
* Include/weakrefobject.h => Include/cpython/weakrefobject.h

Exclude PyWeakref_GET_OBJECT() from the limited C API. It never
worked since the PyWeakReference structure is opaque in the limited C
API.

Move _PyWarnings_Init() and _PyErr_WarnUnawaitedCoroutine() to the
internal C API.
2021-10-19 01:31:57 +02:00
Victor Stinner 354c35220d
bpo-45482: Rename namespaceobject.h to pycore_namespace.h (GH-28975)
Rename Include/namespaceobject.h to
Include/internal/pycore_namespace.h.

The _testmultiphase extension is now built with the
Py_BUILD_CORE_MODULE macro defined to access _PyNamespace_Type.

object.c: remove unused "pycore_context.h" include.
2021-10-15 15:21:21 +02:00
Victor Stinner 105582e74c
bpo-45434: Remove Include/eval.h header file (GH-28973)
Move Include/eval.h content into Include/ceval.h and
Include/cpython/ceval.h, and remove Include/eval.h.
2021-10-15 13:06:05 +02:00
Victor Stinner 063abd931f
bpo-35081: Move interpreteridobject.h to Include/internal/ (GH-28969)
Move the interpreteridobject.h header file from Include/ to
Include/internal/. It only provides private functions.
2021-10-15 11:56:34 +02:00
Victor Stinner 8e5de40f90
bpo-35134: Move classobject.h to Include/cpython/ (GH-28968)
Move classobject.h, context.h, genobject.h and longintrepr.h header
files from Include/ to Include/cpython/.

Remove redundant "#ifndef Py_LIMITED_API" in context.h.

Remove explicit #include "longintrepr.h" in C files. It's not needed,
Python.h already includes it.
2021-10-15 09:46:29 +02:00
Victor Stinner 77b24ba505
bpo-35134: Move Include/cellobject.h to Include/cpython/ (GH-28964) 2021-10-15 02:39:58 +02:00
Victor Stinner 37b1d607bf
po-35134: Move Include/funcobject.h to Include/cpython/ (GH-28958)
Remove redundant "#ifndef Py_LIMITED_API" in funcobject.h.
2021-10-15 01:50:28 +02:00
Victor Stinner 0a883a76cd
bpo-35134: Add Include/cpython/floatobject.h (GH-28957)
Split Include/floatobject.h into sub-files: add
Include/cpython/floatobject.h and
Include/internal/pycore_floatobject.h.
2021-10-14 23:41:06 +02:00
Victor Stinner bbe7497c5a
bpo-45434: Remove pystrhex.h header file (GH-28923)
Move Include/pystrhex.h to Include/internal/pycore_strhex.h.
The header file only contains private functions.

The following C extensions are now built with Py_BUILD_CORE_MODULE
macro defined to get access to the internal C API:

* _blake2
* _hashopenssl
* _md5
* _sha1
* _sha3
* _ssl
* binascii
2021-10-13 15:22:35 +02:00
Inada Naoki 61892c0476
Remove test_nntplib from quicktest (GH-28754) 2021-10-06 17:03:58 +02:00
native-api 417faa69bd
Makefile: Fix missing slashes (GH-28659) 2021-10-02 11:38:59 +02:00
Eric Snow 3e1c5d989a
Install the __phello__ package too. (#28665)
I broke some buildbots by not adding __phello__ to the list of installed packages.

https://bugs.python.org/issue45020
2021-09-30 20:23:32 -06:00
Eric Snow 7e5c107541
bpo-45020: Add more test cases for frozen modules. (gh-28664)
I've added a number of test-only modules. Some of those cases are covered by the recently frozen stdlib modules (and some will be once we add encodings back in). However, I figured we'd play it safe by having a set of modules guaranteed to be there during tests.

https://bugs.python.org/issue45020
2021-09-30 18:38:52 -06:00
Eric Snow 7c801e0fa6
bpo-45020: Fix some corner cases for frozen module generation. (gh-28538)
This also includes some cleanup in preparation for a PR to make the "make all" output less noisy.

https://bugs.python.org/issue45020
2021-09-24 14:35:47 -06:00
Eric Snow 090591636c
bpo-45020: Freeze os, site, and codecs. (gh-28398)
https://bugs.python.org/issue45020
2021-09-17 16:31:31 -06:00
Victor Stinner 41551ee7e2
bpo-45020: Fix build out of source tree (GH-28410)
* Makefile.pre.in: Add $(srcdir) when needed, remove it when it was
  used by mistake.
* freeze_modules.py tool uses ./Programs/_freeze_module if the
  executable doesn't exist in the source tree.
2021-09-17 20:20:43 +02:00
Eric Snow fdc6b3d931
bpo-45020: Drop the frozen .h files from the repo. (gh-28392)
The main advantage is that the files will no longer show up in diffs and PRs. That means, for a PR, the number of files / lines changed will more clearly reflect the actual change.  (This is essentially an un-revert of gh-28375.)

https://bugs.python.org/issue45020
2021-09-16 14:20:52 -06:00
Eric Snow 3814e2036d
bpo-45019: Clean up the frozen __hello__ module. (gh-28374)
Here's one more small cleanup that should have been in PR gh-28319. We eliminate stdout side-effects from importing the frozen __hello__ module, and update tests accordingly. We also move the module's source file into Lib/ from Toos/freeze/flag.py.

https://bugs.python.org/issue45019
2021-09-15 14:15:32 -06:00
Eric Snow cbeb819710
bpo-45020: Freeze some of the modules imported during startup. (gh-28335)
Doing this provides significant performance gains for runtime startup (~15% with all the imported modules frozen). We don't yet freeze all the imported modules because there are a few hiccups in the build systems we need to sort out first. (See bpo-45186 and bpo-45188.)

Note that in PR GH-28320 we added a command-line flag (-X frozen_modules=[on|off]) that allows users to opt out of (or into) using frozen modules. The default is still "off" but we will change it to "on" as soon as we can do it in a way that does not cause contributors pain.

https://bugs.python.org/issue45020
2021-09-15 10:19:30 -06:00
Eric Snow a2d8c4b81b
bpo-45019: Do some cleanup related to frozen modules. (gh-28319)
There are a few things I missed in gh-27980. This is a follow-up that will make subsequent PRs cleaner. It includes fixes to tests and tools that reference the frozen modules.

https://bugs.python.org/issue45019
2021-09-13 16:18:37 -06:00
Eric Snow 044e8d866f
bpo-45019: Add a tool to generate list of modules to include for frozen modules (gh-27980)
Frozen modules must be added to several files in order to work properly. Before this change this had to be done manually. Here we add a tool to generate the relevant lines in those files instead. This helps us avoid mistakes and omissions.

https://bugs.python.org/issue45019
2021-08-30 17:25:11 -06:00
Pablo Galindo Salgado a24676bedc
Add tests for the C tokenizer and expose it as a private module (GH-27924) 2021-08-24 17:50:05 +01:00
Jason R. Coombs e63e6311aa
bpo-44771: Sync with importlib_resources 5.2.2, fixing refleak. (#27497)
* bpo-44771: Sync with importlib_resources 5.2.2, fixing refleak.

* Include new 'resources' dir in the Makefile.
2021-07-30 20:37:09 -04:00