Commit graph

1352 commits

Author SHA1 Message Date
Paul Ganssle 62972d9d73
bpo-40503: PEP 615: Tests and implementation for zoneinfo (GH-19909)
This is the initial implementation of PEP 615, the zoneinfo module,
ported from the standalone reference implementation (see
https://www.python.org/dev/peps/pep-0615/#reference-implementation for a
link, which has a more detailed commit history).

This includes (hopefully) all functional elements described in the PEP,
but documentation is found in a separate PR. This includes:

1. A pure python implementation of the ZoneInfo class
2. A C accelerated implementation of the ZoneInfo class
3. Tests with 100% branch coverage for the Python code (though C code
   coverage is less than 100%).
4. A compile-time configuration option on Linux (though not on Windows)

Differences from the reference implementation:

- The module is arranged slightly differently: the accelerated module is
  `_zoneinfo` rather than `zoneinfo._czoneinfo`, which also necessitates
  some changes in the test support function. (Suggested by Victor
  Stinner and Steve Dower.)
- The tests are arranged slightly differently and do not include the
  property tests. The tests live at test/test_zoneinfo/test_zoneinfo.py
  rather than test/test_zoneinfo.py or test/test_zoneinfo/__init__.py
  because we may do some refactoring in the future that would likely
  require this separation anyway; we may:
        - include the property tests
        - automatically run all the tests against both pure Python and C,
          rather than manually constructing C and Python test classes (similar
          to the way this works with test_datetime.py, which generates C
          and Python test cases from datetimetester.py).
- This includes a compile-time configuration option on Linux (though not
  on Windows); added with much help from Thomas Wouters.
- Integration into the CPython build system is obviously different from
  building a standalone zoneinfo module wheel.
- This includes configuration to install the tzdata package as part of
  CI, though only on the coverage jobs. Introducing a PyPI dependency as
  part of the CI build was controversial, and this is seen as less of a
  major change, since the coverage jobs already depend on pip and PyPI.

Additional changes that were introduced as part of this PR, most / all of
which were backported to the reference implementation:

- Fixed reference and memory leaks

    With much debugging help from Pablo Galindo

- Added smoke tests ensuring that the C and Python modules are built

    The import machinery can be somewhat fragile, and the "seamlessly falls
    back to pure Python" nature of this module makes it so that a problem
    building the C extension or a failure to import the pure Python version
    might easily go unnoticed.

- Adjustments to zoneinfo.__dir__

    Suggested by Petr Viktorin.

- Slight refactorings as suggested by Steve Dower.

- Removed unnecessary if check on std_abbr

    Discovered this because of a missing line in branch coverage.
2020-05-16 10:20:06 +02:00
Steve Dower d6b727e2c9
bpo-40501: Replace ctypes code in uuid with native module (GH-19948) 2020-05-12 23:32:32 +01:00
Victor Stinner b617993b7c
bpo-40602: Rename hashtable.h to pycore_hashtable.h (GH-20044)
* Move Modules/hashtable.h to Include/internal/pycore_hashtable.h
* Move Modules/hashtable.c to Python/hashtable.c
* Python is now linked to hashtable.c. _tracemalloc is no longer
  linked to hashtable.c. Previously, marshal.c got hashtable.c via
  _tracemalloc.c which is built as a builtin module.
2020-05-12 02:42:19 +02:00
Petr Viktorin e1becf46b4
bpo-38787: C API for module state access from extension methods (PEP 573) (GH-19936)
Module C state is now accessible from C-defined heap type methods (PEP 573).
Patch by Marcel Plch and Petr Viktorin.

Co-authored-by: Marcel Plch <mplch@redhat.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2020-05-07 15:39:59 +02:00
Steve Dower ac4bf42411
bpo-40458: Increase reserved stack space to prevent overflow crash on Windows (GH-19845) 2020-05-05 18:45:35 +01:00
Anthony Shaw 9b64ef3ac7
bpo-40432 Fix MSBuild project for Pegen grammars (#GH-9785)
* Update the source path of the pegen target within the Windows regen project.
Change the path to Windows path formats.

* Use the more reliable SetEnv task for Cpp Projects in MSBuild.
2020-04-29 10:09:09 +01:00
Victor Stinner b8f704d219
bpo-40421: Add Include/cpython/code.h header file (GH-19756)
bpo-35134, bpo-40421: Add Include/cpython/code.h header file.

code.h now defines PyCodeObject type in the limited C API. It is now
included by Python.h.

Give a name to the PyCodeObject structure: it is now called
"struct PyCodeObject". So it becomes possible to define PyCodeObject
as "struct PyCodeObject" in the limited C API without defining the
structure.
2020-04-28 17:07:12 +02:00
Victor Stinner 7c59d7c986
bpo-40421: Add pyframe.h header file (GH-19755)
Add a new separated pyframe.h header file of the PyFrame public C
API: it is included by Python.h.

Add PyFrame_GetLineNumber() to the limited C API.

Replace "struct _frame" with "PyFrameObject" in header files.
PyFrameObject is now defined as struct _frame by pyframe.h which is
included early enough in Python.h.
2020-04-28 16:32:48 +02:00
Pablo Galindo 5b9f4988c9
bpo-40334: Refactor peg_generator to receive a Tokens file when building c code (GH-19745) 2020-04-28 13:11:55 +01:00
Pablo Galindo 4044c843a5
Add files in tests/test_peg_generator to the install target lists (GH-19723)
Update the "Makefile.pre.in" template and the "PCbuild/lib.pyproj" with the files in "Lib/test/test/test_peg_generator" so they get correctly installed along the rest of the standard library.
2020-04-27 11:18:04 +01:00
Ammar Askar a494caa14b
bpo-40401: Remove duplicate pyhash.h include from pythoncore.vcxproj (GH-19725) 2020-04-26 21:08:17 -05:00
Lysandros Nikolaou ebebb6429c
bpo-40334: Improve various PEG-Parser related stuff (GH-19669)
The changes in this commit are all related to @vstinner's original review comments of the initial PEP 617 implementation PR.
2020-04-23 16:36:06 +01:00
Pablo Galindo c5fc156852
bpo-40334: PEP 617 implementation: New PEG parser for CPython (GH-19503)
Co-authored-by: Guido van Rossum <guido@python.org>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2020-04-22 23:29:27 +01:00
Miro Hrončok 3a69f3caee
bpo-38439: Add 256px IDLE icon (GH-17473)
Icon author: Andrew Clover, bpo-1490384
2020-04-22 03:21:44 -04:00
Victor Stinner 1ae035b7e8
bpo-40302: Add pycore_byteswap.h header file (GH-19552)
Add a new internal pycore_byteswap.h header file with the following
functions:

* _Py_bswap16()
* _Py_bswap32()
* _Py_bswap64()

Use these functions in _ctypes, sha256 and sha512 modules,
and also use in the UTF-32 encoder.

sha256, sha512 and _ctypes modules are now built with the internal
C API.
2020-04-17 17:47:20 +02:00
Ammar Askar 58d6f2ee3a
bpo-40270: Enable json extension in Windows sqlite extension (GH-19528) 2020-04-15 16:19:26 -05:00
Victor Stinner 0c13e1f96a
bpo-40241: Add pycore_interp.h header (GH-19499)
Move PyInterpreterState and related functions to a new internal
pycore_interp.h header file.
2020-04-13 12:47:17 +02:00
Victor Stinner 1c4cbdf94d
bpo-40268: Add pycore_runtime.h header file (GH-19493)
Move PyRuntimeState from pycore_pystate.h to pycore_runtime.h.

Remove _PyGILState_check_enabled macro: access directly
_PyRuntime.gilstate.check_enabled.
2020-04-13 11:45:21 +02:00
Victor Stinner a15e260b70
bpo-40170: Add _PyIndex_Check() internal function (GH-19426)
Add _PyIndex_Check() function to the internal C API: fast inlined
verson of PyIndex_Check().

Add Include/internal/pycore_abstract.h header file.

Replace PyIndex_Check() with _PyIndex_Check() in C files of Objects
and Python subdirectories.
2020-04-08 02:01:56 +02:00
Guido van Rossum 48b069a003
bpo-39481: Implementation for PEP 585 (#18239)
This implements things like `list[int]`,
which returns an object of type `types.GenericAlias`.
This object mostly acts as a proxy for `list`,
but has attributes `__origin__` and `__args__`
that allow recovering the parts (with values `list` and `(int,)`.

There is also an approximate notion of type variables;
e.g. `list[T]` has a `__parameters__` attribute equal to `(T,)`.
Type variables are objects of type `typing.TypeVar`.
2020-04-07 09:50:06 -07:00
Steve Dower a1d4dbdfc7
bpo-40164: Update Windows to OpenSSL 1.1.1f (GH-19359) 2020-04-04 15:19:08 +01:00
Victor Stinner 08faf0016e
bpo-38644: Add _PySys_Audit() which takes tstate (GH-19180)
Add _PySys_Audit() function to the internal C API: similar to
PySys_Audit(), but requires a mandatory tstate parameter.

Cleanup sys_audit_tstate() code: remove code path for NULL tstate,
since the function exits at entry if tstate is NULL. Remove also code
path for NULL tstate->interp: should_audit() now ensures that it is
not NULL (even if tstate->interp cannot be NULL in practice).

PySys_AddAuditHook() now checks if tstate is not NULL to decide if
tstate can be used or not, and tstate is set to NULL if the runtime
is not initialized yet.

Use _PySys_Audit() in sysmodule.c.
2020-03-26 18:57:32 +01:00
Steve Dower 894adc18b4
bpo-39930: Fix MSBuild detection for Build Tools (GH-18938)
Ensure we detect Build Tools installs using the newer logic, and skip looking in the registry for VS 2017.
2020-03-11 16:24:30 -07:00
Steve Dower fde44ae6d0
bpo-39930: Convert error to warning for more silent failure (GH-18921)
Makes it an error to create a layout without vcruntime DLL
2020-03-11 14:12:31 +00:00
Steve Dower 2dd41740c9
bpo-39930: Ensure vcruntime140.dll is included in all Windows packages (GH-18918)
Also adds GitHub CI test for Windows installer changes
2020-03-11 11:18:12 +00:00
Steve Dower ce3a498408
bpo-38597: Never statically link extension initialization code on Windows (GH-18724) 2020-03-03 00:04:11 +00:00
Erlend Egeberg Aasland 1382c3289b
bpo-38380: Update macOS & Windows builds to SQLite v3.31.1 (GH-18678)
Automerge-Triggered-By: @zooba
2020-03-02 04:25:10 -08:00
Victor Stinner 8c3aee65ed
bpo-35134: Add Include/cpython/fileutils.h header file (GH-18493)
Move CPython C API from Include/fileutils.h into a new
Include/cpython/fileutils.h header file which is included by
Include/fileutils.h.

Exclude the following private symbols from the limited C API:

* _Py_error_handler
* _Py_GetErrorHandler()
* _Py_DecodeLocaleEx()
* _Py_EncodeLocaleEx()
2020-02-12 23:55:09 +01:00
Victor Stinner 98921aeaf5
bpo-35134: Add Include/cpython/bytesobject.h file (GH-18494)
Add Include/cpython/bytearrayobject.h and
Include/cpython/bytesobject.h header files.

Move CPython C API from Include/bytesobject.h into a new
Include/cpython/bytesobject.h header file which is included by
Include/bytesobject.h. Do a similar change for
Include/bytearrayobject.h.
2020-02-12 23:54:31 +01:00
Victor Stinner e9e7d284c4
bpo-35081: Move dtoa.h header to the internal C API (GH-18489)
Move the dtoa.h header file to the internal C API as pycore_dtoa.h:
it only contains private functions (prefixed by "_Py").

The math and cmath modules must now be compiled with the
Py_BUILD_CORE macro defined.
2020-02-12 22:54:42 +01:00
Victor Stinner 45876a90e2
bpo-35081: Move bytes_methods.h to the internal C API (GH-18492)
Move the bytes_methods.h header file to the internal C API as
pycore_bytes_methods.h: it only contains private symbols (prefixed by
"_Py"), except of the PyDoc_STRVAR_shared() macro.
2020-02-12 22:32:34 +01:00
Victor Stinner bec4186c67
bpo-35134: Create Include/cpython/listobject.h (GH-18395)
Move listobject.h code surrounded by "#ifndef Py_LIMITED_API"
to a new Include/cpython/listobject.h header file.

Add cpython/ header files to Makefile.pre.in and pythoncore project
of PCbuild.

Add _PyList_CAST() macro.
2020-02-07 09:20:21 +01:00
Anthony Shaw 89ae20b30e
bpo-39185 Add the d[etailed] and q[uiet] verbosity levels for msbuild (GH-17791) 2020-02-05 11:30:19 +11:00
Steve Dower 6a65eba44b
bpo-39401: Avoid unsafe DLL load on Windows 7 and earlier (GH-18231)
As Windows 7 is not supported by Python 3.9, we just replace the dynamic load with a static import. Backports will have a different fix to ensure they continue to behave the same.
2020-01-29 13:46:33 +11:00
Dino Viehland 0cd5bff6b7
bpo-39459: include missing test files in windows installer
Adds missing test files to Windows installer to wrap up bpo-39459
2020-01-28 13:24:12 -08:00
Steve Dower a9d0a6a1b9
bpo-36500: Simplify PCbuild/build.bat and prevent path separator changing in comments (GH-17644) 2019-12-17 14:14:13 -08:00
Anthony Shaw 9e36589d49 bpo-36500: Add --regen option to PCbuild/build.bat so Windows users can regen grammar, opcodes, tokens and symbols (GH-12654) 2019-12-17 13:21:20 -08:00
Steve Dower de148f263f
bpo-33125: Add support for building and releasing Windows ARM64 packages (GH-16828)
Note that the support is not actually enabled yet, and so we won't be publishing these packages. However, for those who want to build it themselves (even by reusing the Azure Pipelines definition), it's now relatively easy to enable.
2019-11-20 09:30:47 -08:00
Segev Finer abce2d9bc6 Add Python 3.8 to py based search in find_python.bat (GH-17188) 2019-11-20 09:25:45 -08:00
Tal Einat ee703cbb41 bpo-38809: Windows build scripts use python.exe from virtual envs (GH-17164)
https://bugs.python.org/issue38809
2019-11-18 09:32:25 -08:00
Victor Stinner 4d231bcc77
bpo-38644: Add _PyObject_Call() (GH-17089)
* Add pycore_call.h internal header file.
* Add _PyObject_Call(): PyObject_Call() with tstate
* Add _PyObject_CallNoArgTstate(): _PyObject_CallNoArg() with tstate
* Add _PyObject_FastCallDictTstate(): _PyObject_FastCallDict()
  with tstate
* _PyObject_Call_Prepend() now takes tstate
* Replace _PyObject_FastCall() calls
  with _PyObject_VectorcallTstate() calls
2019-11-14 13:36:21 +01:00
Victor Stinner f4b1e3d7c6
bpo-38644: Add Py_EnterRecursiveCall() to the limited API (GH-17046)
Provide Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() as
regular functions for the limited API. Previously, there were defined
as macros, but these macros didn't work with the limited API which
cannot access PyThreadState.recursion_depth field.

Remove _Py_CheckRecursionLimit from the stable ABI.

Add Include/cpython/ceval.h header file.
2019-11-04 19:48:34 +01:00
Steve Dower 7aebbd1182
bpo-38492: Remove pythonw.exe dependency on the Microsoft C++ runtime (GH-16824) 2019-10-16 10:27:17 -07:00
Benjamin Peterson 52b9408038
closes bpo-38174: Update vendored expat library to 2.2.8. (GH-16346)
Fixes CVE-2019-15903. See full changelog at https://github.com/libexpat/libexpat/blob/R_2_2_8/expat/Changes.
2019-09-25 21:33:58 -07:00
Steve Dower 3ab73f6bbf
bpo-38117: Update bundled Windows OpenSSL to 1.1.1d (GH-16184) 2019-09-16 15:21:16 +01:00
Steve Dower 8fcaffb048 bpo-37326: Include libffi license when available (GH-15921) 2019-09-11 13:43:00 +01:00
Greg Price 1ad0c776cb bpo-38043: Move unicodedata.normalize tests into test_unicodedata. (GH-15712)
Having these in a separate file from the one that's named after the
module in the usual way makes it very easy to miss them when looking
for tests for these two functions.

(In fact when working recently on is_normalized, I'd been surprised to
see no tests for it here and concluded the function had evaded being
tested at all.  I'd gone as far as to write up some tests myself
before I spotted this other file.)

Mostly this just means moving all the one file's code into the other,
and moving code from the module toplevel to inside the test class to
keep it tidily separate from the rest of the file's code.

There's one substantive change, which reduces by a bit the amount of
code to be moved: we drop the `x > sys.maxunicode` conditional and all
the `RangeError` logic behind it.  Now if that condition ever occurs
it will cause an error at `chr(x)`, and a test failure.  That's the
right result because, since PEP 393 in Python 3.3, there is no longer
such a thing as an "unsupported character".
2019-09-10 10:29:26 +01:00
Greg Price fa3a38d81f Mark files as executable that are meant as scripts. (GH-15354)
This is the converse of GH-15353 -- in addition to plenty of
scripts in the tree that are marked with the executable bit
(and so can be directly executed), there are a few that have
a leading `#!` which could let them be executed, but it doesn't
do anything because they don't have the executable bit set.

Here's a command which finds such files and marks them.  The
first line finds files in the tree with a `#!` line *anywhere*;
the next-to-last step checks that the *first* line is actually of
that form.  In between we filter out files that already have the
bit set, and some files that are meant as fragments to be
consumed by one or another kind of preprocessor.

    $ git grep -l '^#!' \
      | grep -vxFf <( \
          git ls-files --stage \
          | perl -lane 'print $F[3] if (!/^100644/)' \
        ) \
      | grep -ve '\.in$' -e '^Doc/includes/' \
      | while read f; do
          head -c2 "$f" | grep -qxF '#!' \
          && chmod a+x "$f"; \
        done
2019-09-09 07:16:33 -07:00
Dong-hee Na 0a18ee4be7 bpo-37798: Add C fastpath for statistics.NormalDist.inv_cdf() (GH-15266) 2019-08-23 15:20:30 -07:00
Steve Dower b0dace3e97
bpo-37841: Remove python_uwp dependency on msvcp140.dll (GH-15253) 2019-08-13 10:34:07 -07:00
Min ho Kim c4cacc8c5e Fix typos in comments, docs and test names (#15018)
* Fix typos in comments, docs and test names

* Update test_pyparse.py

account for change in string length

* Apply suggestion: splitable -> splittable

Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu>

* Apply suggestion: splitable -> splittable

Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu>

* Apply suggestion: Dealloccte -> Deallocate

Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu>

* Update posixmodule checksum.

* Reverse idlelib changes.
2019-07-30 18:16:13 -04:00
Steve Dower e1b9002472 bpo-36044: Avoid warnings in Windows PGO build and add lzma, bz2 and sqlite coverage (GH-14985)
https://bugs.python.org/issue36044



Automerge-Triggered-By: @zooba
2019-07-28 18:01:12 -07:00
Stefan Krah f117d871c4
Rename memory.c to mpalloc.c for consistency with the header file. (#14687) 2019-07-10 18:27:38 +02:00
Victor Stinner e21b45a8e7
bpo-37472: Remove Lib/test/outstanding_bugs.py (GH-14516) 2019-07-01 18:35:07 +02:00
animalize 8bd2872adb bpo-25361: Enable SSE2 instructions for Windows 32-bit build (GH-12438) 2019-06-24 16:43:26 -07:00
animalize 7fd2ba354e bpo-35360: Update Windows builds to use SQLite 3.28.0 (GH-14179) 2019-06-24 16:22:14 -07:00
Steve Dower 12f1c726d8
bpo-37333: Ensure IncludeTkinter has a value (GH-14240) 2019-06-19 13:07:23 -07:00
Victor Stinner 01b63ecac6
bpo-35134: Add Include/cpython/import.h header file (GH-14213)
* Add Include/cpython/import.h and Include/internal/pycore_import.h
  header files.
* Move _PyImport_ReInitLock() to the internal C API. Don't export the
  symbol anymore.
2019-06-19 00:48:09 +02:00
Steve Dower a268edd6a4
bpo-34631: Updated OpenSSL to 1.1.1c in Windows installer (GH-14163) 2019-06-17 11:36:08 -07:00
Paul Monson 00f6493084 bpo-37288: Fix Windows build when --no-tkinter is specified (GH-14096) 2019-06-17 08:21:28 -07:00
Victor Stinner 8bf08ee45b
bpo-37312: Remove _dummy_thread and dummy_threading modules (GH-14143)
Remove _dummy_thread and dummy_threading modules. These modules
were deprecated since Python 3.7 which requires threading support.
2019-06-17 14:18:43 +02:00
Steve Dower 21a92f8cda
Implement Windows release builds in Azure Pipelines (GH-14065) 2019-06-14 08:29:20 -07:00
Paul Monson 04856c2193 bpo-37238: Enable building for Windows using Visual Studio 2019 (GH-13988) 2019-06-11 15:03:17 -07:00
Paul Monson e7e5039d69 bpo-37181: Fix test_regrtest failures on Windows arm64 (GH-13872) 2019-06-07 10:58:41 -07:00
Łukasz Langa 9ab2fb1c68
Bump to 3.9.0a0 2019-06-04 22:12:32 +02:00
Inada Naoki 91234a1636
bpo-26219: per opcode cache for LOAD_GLOBAL (GH-12884)
This patch implements per opcode cache mechanism, and use it in
only LOAD_GLOBAL opcode.

Based on Yury's opcache3.patch in bpo-26219.
2019-06-03 21:30:58 +09:00
Zackery Spytz 8f96c9f8ed bpo-37007: Implement socket.if_nametoindex(), if_indextoname() and if_nameindex() on Windows (GH-13522) 2019-05-29 14:02:37 -07:00
Victor Stinner 331a6a56e9
bpo-36763: Implement the PEP 587 (GH-13592)
* Add a whole new documentation page:
  "Python Initialization Configuration"
* PyWideStringList_Append() return type is now PyStatus,
  instead of int
* PyInterpreterState_New() now calls PyConfig_Clear() if
  PyConfig_InitPythonConfig() fails.
* Rename files:

  * Python/coreconfig.c => Python/initconfig.c
  * Include/cpython/coreconfig.h => Include/cpython/initconfig.h
  * Include/internal/: pycore_coreconfig.h => pycore_initconfig.h

* Rename structures

  * _PyCoreConfig => PyConfig
  * _PyPreConfig => PyPreConfig
  * _PyInitError => PyStatus
  * _PyWstrList => PyWideStringList

* Rename PyConfig fields:

  * use_module_search_paths => module_search_paths_set
  * module_search_path_env => pythonpath_env

* Rename PyStatus field: _func => func
* PyInterpreterState: rename core_config field to config
* Rename macros and functions:

  * _PyCoreConfig_SetArgv() => PyConfig_SetBytesArgv()
  * _PyCoreConfig_SetWideArgv() => PyConfig_SetArgv()
  * _PyCoreConfig_DecodeLocale() => PyConfig_SetBytesString()
  * _PyInitError_Failed() => PyStatus_Exception()
  * _Py_INIT_ERROR_TYPE_xxx enums => _PyStatus_TYPE_xxx
  * _Py_UnixMain() => Py_BytesMain()
  * _Py_ExitInitError() => Py_ExitStatusException()
  * _Py_PreInitializeFromArgs() => Py_PreInitializeFromBytesArgs()
  * _Py_PreInitializeFromWideArgs() => Py_PreInitializeFromArgs()
  * _Py_PreInitialize() => Py_PreInitialize()
  * _Py_RunMain() => Py_RunMain()
  * _Py_InitializeFromConfig() => Py_InitializeFromConfig()
  * _Py_INIT_XXX() => _PyStatus_XXX()
  * _Py_INIT_FAILED() => _PyStatus_EXCEPTION()

* Rename 'err' PyStatus variables to 'status'
* Convert RUN_CODE() macro to config_run_code() static inline function
* Remove functions:

  * _Py_InitializeFromArgs()
  * _Py_InitializeFromWideArgs()
  * _PyInterpreterState_GetCoreConfig()
2019-05-27 16:39:22 +02:00
Antoine Pitrou 91f4380ced
bpo-36785: PEP 574 implementation (GH-7076) 2019-05-26 17:10:09 +02:00
Victor Stinner 438a12dd9d
bpo-36710: Add tstate parameter in ceval.c (GH-13547)
* Fix a possible reference leak in _PyErr_Print() if exception
  is NULL.
* PyErr_BadInternalCall(): replace PyErr_Format() with _PyErr_SetString().
* Add pycore_pyerrors.h header file.
* New functions:

  * _PyErr_Clear()
  * _PyErr_Fetch()
  * _PyErr_Print()
  * _PyErr_Restore()
  * _PyErr_SetObject()
  * _PyErr_SetString()

* Add 'tstate' parameter to _PyEval_AddPendingCall().
2019-05-24 17:01:38 +02:00
Steve Dower b82e17e626
bpo-36842: Implement PEP 578 (GH-12613)
Adds sys.audit, sys.addaudithook, io.open_code, and associated C APIs.
2019-05-23 08:45:22 -07:00
Paul Monson cfb241bd29 bpo-36941: Project file fixups for Windows ARM64 (GH-13477) 2019-05-22 15:16:21 -07:00
Victor Stinner fd1e0e93b1
bpo-35134: Register new traceback.h header files (GH-13431)
Add new cpython/traceback.h and pycore_traceback.h header files to
Makefile.pre.in and PCbuild/ project.
2019-05-20 02:22:32 +02:00
Paul Monson f96e7fd924 bpo-36941: Windows build changes for Windows ARM64 (GH-13365) 2019-05-17 10:07:24 -07:00
Paul Monson 67ff6a103a bpo-36511: Windows ARM32 buildbot changes (GH-12917) 2019-05-15 15:42:29 -07:00
Paul Monson fb7e7505ed bpo-35926: Add support for OpenSSL 1.1.1b on Windows (GH-11779) 2019-05-15 15:38:55 -07:00
Pierre Glaser f22cc69b01 bpo-36867: Make semaphore_tracker track other system resources (GH-13222)
The multiprocessing.resource_tracker replaces the multiprocessing.semaphore_tracker module. Other than semaphores, resource_tracker also tracks shared_memory segments. Patch by Pierre Glaser.
2019-05-10 22:59:08 +02:00
Paul Monson 62dfd7d6fe bpo-35920: Windows 10 ARM32 platform support (GH-11774) 2019-04-25 18:36:45 +00:00
Victor Stinner 23bace26ec
bpo-36635: Add _testinternalcapi module (GH-12841)
Add a new _testinternalcapi module to test the internal C API.

Move _Py_GetConfigsAsDict() function to the internal C API:
_testembed now uses _testinternalcapi to access the function.
2019-04-18 11:37:26 +02:00
Paul Monson 11efd79076 bpo-36071 Add support for Windows ARM32 in ctypes/libffi (GH-12059) 2019-04-17 18:09:16 -07:00
Victor Stinner 5c75f37d47
bpo-36635: Change pyport.h for Py_BUILD_CORE_MODULE define (GH-12853)
Change PyAPI_FUNC(type), PyAPI_DATA(type) and PyMODINIT_FUNC macros
of pyport.h when Py_BUILD_CORE_MODULE is defined.

The Py_BUILD_CORE_MODULE define must be now be used to build a C
extension as a dynamic library accessing Python internals: export the
PyInit_xxx() function in DLL exports on Windows.

Changes:

* Py_BUILD_CORE_BUILTIN and Py_BUILD_CORE_MODULE now imply
  Py_BUILD_CORE directy in pyport.h.
* ceval.c compilation now fails with an error if Py_BUILD_CORE is not
  defined, just to ensure that Python is build with the correct
  defines.
* setup.py now compiles _pickle.c with Py_BUILD_CORE_MODULE define.
* setup.py compiles _json.c with Py_BUILD_CORE_MODULE define, rather
  than Py_BUILD_CORE_BUILTIN define
* PCbuild/pythoncore.vcxproj: Add Py_BUILD_CORE_BUILTIN define.
2019-04-17 23:02:26 +02:00
Victor Stinner aba7d662ab
bpo-35134: Add cpython/pymem.h to build system (GH-12842) 2019-04-15 17:29:31 +02:00
Pablo Galindo f2cf1e3e28
bpo-36623: Clean parser headers and include files (GH-12253)
After the removal of pgen, multiple header and function prototypes that lack implementation or are unused are still lying around.
2019-04-13 17:05:14 +01:00
Paul Monson 32119e10b7 bpo-35947: Update Windows to the current version of libffi (GH-11797)
We now use a pre-built libffi binary from our binaries repository, and no longer vendor the full implementation.
2019-03-29 16:30:10 -07:00
Jeroen Demeyer 3396d1e0ca bpo-36448: mention 'make regen-all' in error message (GH-12585) 2019-03-29 11:37:22 -07:00
Steve Dower b95a79c928
bpo-36245: Fix more empty environment variable checks (GH-12592) 2019-03-27 16:28:41 -07:00
Isuru Fernando aedc273fd9 Fix registry key for Windows SDK detection (GH-12445) 2019-03-21 10:52:57 -07:00
Jess 7ee88bf3e5 bpo-36245: Avoid problems when building in a directory containing spaces. (GH-12241) 2019-03-21 09:02:59 -07:00
Inada Naoki 6a16b18224
bpo-36297: remove "unicode_internal" codec (GH-12342) 2019-03-18 15:44:11 +09:00
Eric Snow c11183cdcf
bpo-36097: Use only public C-API in the_xxsubinterpreters module (adding as necessary). (gh-12359) 2019-03-15 16:35:46 -06:00
Steve Dower 2f8f56499c
bpo-36108: Avoid failing the build on race condition in clean (GH-12217) 2019-03-07 09:09:15 -08:00
Victor Stinner 4d61e6e3b8
Revert: bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). (GH-11617) (GH-12159)
* Revert "bpo-36097: Use only public C-API in the_xxsubinterpreters module (adding as necessary). (#12003)"

This reverts commit bcfa450f21.

* Revert "bpo-33608: Simplify ceval's DISPATCH by hoisting eval_breaker ahead of time. (gh-12062)"

This reverts commit bda918bf65.

* Revert "bpo-33608: Use _Py_AddPendingCall() in _PyCrossInterpreterData_Release(). (gh-12024)"

This reverts commit b05b711a2c.

* Revert "bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). (GH-11617)"

This reverts commit ef4ac967e2.
2019-03-04 14:21:28 +01:00
Eric Snow bcfa450f21
bpo-36097: Use only public C-API in the_xxsubinterpreters module (adding as necessary). (#12003) 2019-03-01 16:50:31 -07:00
Pablo Galindo 1f24a719e7
bpo-35808: Retire pgen and use pgen2 to generate the parser (GH-11814)
Pgen is the oldest piece of technology in the CPython repository, building it requires various #if[n]def PGEN hacks in other parts of the code and it also depends more and more on CPython internals. This commit removes the old pgen C code and replaces it for a new version implemented in pure Python. This is a modified and adapted version of lib2to3/pgen2 that can generate grammar files compatibles with the current parser.

This commit also eliminates all the #ifdef and code branches related to pgen, simplifying the code and making it more maintainable. The regen-grammar step now uses $(PYTHON_FOR_REGEN) that can be any version of the interpreter, so the new pgen code maintains compatibility with older versions of the interpreter (this also allows regenerating the grammar with the current CI solution that uses Python3.5). The new pgen Python module also makes use of the Grammar/Tokens file that holds the token specification, so is always kept in sync and avoids having to maintain duplicate token definitions.
2019-03-01 15:34:44 -08:00
Victor Stinner 91b9ecf82c
bpo-36142: Add preconfig.c (GH-12128)
* Add _PyArgv_Decode() function
* Move _Py_ClearFileSystemEncoding() and _Py_SetFileSystemEncoding()
  to preconfig.c.
2019-03-01 17:52:56 +01:00
Victor Stinner f684d83d86
bpo-36142: Exclude coreconfig.h from Py_LIMITED_API (GH-12111)
The whole coreconfig.h header is now excluded from Py_LIMITED_API.
Move functions definitions into a new internal pycore_coreconfig.h
header.

* Move Include/coreconfig.h to Include/cpython/coreconfig.h
* coreconfig.h header is now excluded from Py_LIMITED_API
* Move functions to pycore_coreconfig.h
2019-03-01 03:44:13 +01:00
Paul Monson 8a1657b934 bpo-35976: Enable Windows projects to build with platform ARM32 (GH-11825)
This change adds the necessary items to the build projects to avoid erroring out right at the start. It does not add _support_ for targeting Windows on ARM32, but is a necessary prerequisite for adding it.
2019-02-14 08:31:30 -08:00
Steve Dower 4c70d9f79c
bpo-34691: Compile _contextvars module into main Python library (GH-11741) 2019-02-02 14:36:23 -08:00
antektek 6aedfa6b9a bpo-34855: Fix EXTERNALS_DIR build variable for Windows (GH-11177) 2019-01-10 11:19:29 +11:00
Gregory Szorc fbf50683b3 bpo-35642: Remove asynciomodule.c from pythoncore.vcxproj (GH-11410)
This module is built by _asyncio.vcxproj and does not need to be included in pythoncore.
2019-01-07 17:27:18 -08:00
Serhiy Storchaka 8ac658114d
bpo-30455: Generate all token related code and docs from Grammar/Tokens. (GH-10370)
"Include/token.h", "Lib/token.py" (containing now some data moved from
"Lib/tokenize.py") and new files "Parser/token.c" (containing the code
moved from "Parser/tokenizer.c") and "Doc/library/token-list.inc" (included
in "Doc/library/token.rst") are now generated from "Grammar/Tokens" by
"Tools/scripts/generate_token.py". The script overwrites files only if
needed and can be used on the read-only sources tree.

"Lib/symbol.py" is now generated by "Tools/scripts/generate_symbol_py.py"
instead of been executable itself.

Added new make targets "regen-token" and "regen-symbol" which are now
dependencies of "regen-all".

The documentation contains now strings for operators and punctuation tokens.
2018-12-22 11:18:40 +02:00
Steve Dower d3bbc52413
Enable signing Windows builds with SHA1 environment variable (GH-11279) 2018-12-21 13:48:18 -08:00
Steve Dower f8e9bd568a
bpo-35402: Update Windows build to use Tcl and Tk 8.6.9 (GH-11146) 2018-12-14 09:13:15 -08:00
Victor Stinner d7538dd5e3
bpo-35471: Remove the macpath module (GH-11129)
Python 2.4 dropped MacOS 9 support. The macpath module was deprecated
in Python 3.7. This change removes it.
2018-12-14 13:37:26 +01:00
Steve Dower 4824385fec
bpo-35401: Update Windows build to OpenSSL 1.1.0j (GH-11088) 2018-12-10 19:52:36 -08:00
Steve Dower 0cd6391fd8
bpo-34977: Add Windows App Store package (GH-11027)
Also adds the PC/layout script for generating layouts on Windows.
2018-12-10 18:52:57 -08:00
Steve Dower 1c3de541e6
bpo-34977: Use venv redirector instead of original python.exe on Windows (GH-11029) 2018-12-10 08:11:21 -08:00
Jeremy Kloth f46eccd0ff bpo-35433: Properly detect installed SDK versions (GH-11009) 2018-12-09 19:59:32 -08:00
Victor Stinner cb0b78a070
Revert "bpo-34977: Add Windows App Store package (GH-10245)" (GH-11019)
This reverts commit 468a15aaf9.
2018-12-07 12:57:43 +01:00
Steve Dower 468a15aaf9
bpo-34977: Add Windows App Store package (GH-10245) 2018-12-06 21:09:20 -08:00
Victor Stinner 54ba556c6c
bpo-35134: Create Include/cpython/tupleobject.h (GH-10764)
Move tupleobject.h code surrounded by "#ifndef Py_LIMITED_API"
to a new Include/cpython/tupleobject.h header file.

Add cpython/ header files to Makefile.pre.in and pythoncore project
of PCbuild.
2018-11-28 13:01:32 +01:00
Victor Stinner ec13b9322d
bpo-35081: Add Include/internal/pycore_tupleobject.h (GH-10705)
Move _PyTuple_ITEMS() to a new header file:
Include/internal/pycore_tupleobject.h
2018-11-25 23:56:17 +01:00
Victor Stinner e421106b9e
bpo-35134: Create Include/cpython/ subdirectory (GH-10624)
Include/*.h should be the "portable Python API", whereas
Include/cpython/*.h should be the "CPython API": CPython
implementation details.

Changes:

* Create Include/cpython/ subdirectory
* "make install" now creates $prefix/include/cpython and copy
  Include/cpython/* to $prefix/include/cpython
* Create Include/cpython/objimpl.h: move objimpl.h code
  surrounded by "#ifndef Py_LIMITED_API" to cpython/objimpl.h.
* objimpl.h now includes cpython/objimpl.h
* Windows installer (MSI) now also install Include/ subdirectories:
  Include/cpython/ and Include/internal/.
2018-11-23 17:00:00 +01:00
Victor Stinner 984061eeb4
bpo-35081: Add new internal headers to Makefile (GH-10670)
Add pycore_fileutils.h and pycore_object.h to Makefile.pre.in and to
the pythoncore project of PCbuild/.
2018-11-23 12:30:40 +01:00
Victor Stinner 621cebe81b
bpo-35081: Rename internal headers (GH-10275)
Rename Include/internal/ headers:

* pycore_hash.h -> pycore_pyhash.h
* pycore_lifecycle.h -> pycore_pylifecycle.h
* pycore_mem.h -> pycore_pymem.h
* pycore_state.h -> pycore_pystate.h

Add missing headers to Makefile.pre.in and PCbuild:

* pycore_condvar.h.
* pycore_hamt.h
* pycore_pyhash.h
2018-11-12 16:53:38 +01:00
Victor Stinner a1c249c405
bpo-35081: And pycore_lifecycle.h and pycore_pathconfig.h (GH-10273)
* And pycore_lifecycle.h and pycore_pathconfig.h headers to
  Include/internal/
* Move Py_BUILD_CORE specific code from coreconfig.h and
  pylifecycle.h to pycore_pathconfig.h and pycore_lifecycle.h
* Move _Py_wstrlist_XXX() definitions and _PyPathConfig code
  from pycore_state.h to pycore_pathconfig.h
* Move "Init" and "Fini" function definitions from pylifecycle.c to
  pycore_lifecycle.h.
2018-11-01 03:15:58 +01:00
Victor Stinner e281f7d80c
bpo-35081: Move accu.h to Include/internal/pycore_accu.h (GH-10271)
The accu.h header is no longer part of the Python C API: it has been
moved to the "internal" headers which are restricted to Python
itself.

Replace #include "accu.h" with #include "pycore_accu.h".
2018-11-01 02:30:36 +01:00
Victor Stinner 27e2d1f219
bpo-35081: Add pycore_ prefix to internal header files (GH-10263)
* Rename Include/internal/ header files:

  * pyatomic.h -> pycore_atomic.h
  * ceval.h -> pycore_ceval.h
  * condvar.h -> pycore_condvar.h
  * context.h -> pycore_context.h
  * pygetopt.h -> pycore_getopt.h
  * gil.h -> pycore_gil.h
  * hamt.h -> pycore_hamt.h
  * hash.h -> pycore_hash.h
  * mem.h -> pycore_mem.h
  * pystate.h -> pycore_state.h
  * warnings.h -> pycore_warnings.h

* PCbuild project, Makefile.pre.in, Modules/Setup: add the
  Include/internal/ directory to the search paths of header files.
* Update includes. For example, replace #include "internal/mem.h"
  with #include "pycore_mem.h".
2018-11-01 00:52:28 +01:00
Victor Stinner 31368a4f0e
bpo-35081: Move Include/pyatomic.c to Include/internal/ (GH-10239)
Add pyatomic.h to the VS project (it wasn't referenced).
2018-10-30 15:14:25 +01:00
Steve Dower 53125a53f4
bpo-35067: Remove _distutils_findvs and use vswhere.exe instead. (GH-10095) 2018-10-27 16:48:33 -04:00
Victor Stinner a05bef4f5b
bpo-35059, PCbuild: Expand inline funcs in Debug (GH-10094)
Visual Studio solution: Set InlineFunctionExpansion to
OnlyExplicitInline ("/Ob1" option) on all projects (in
pyproject.props) in Debug mode on Win32 and x64 platforms to expand
functions marked as inline.

This change should make Python compiled in Debug mode a little bit
faster on Windows. On Unix, GCC uses -Og optimization level for
./configure --with-pydebug.
2018-10-26 15:10:29 +02:00
Victor Stinner 6279c1c500
bpo-35053: Add Include/tracemalloc.h (GH-10091)
* Modify object.h to ensure that pymem.h is included,
  to get _Py_tracemalloc_config variable.
* Move _PyTraceMalloc_XXX() functions to tracemalloc.h,
  they need PyObject type. Break circular dependency between pymem.h
  and object.h.
2018-10-25 15:54:13 +02:00
Jeremy Kloth fa5329424f bpo-34980: P/Invoke QueryFullProcessImageName to get process names (GH-9901) 2018-10-23 07:41:48 -04:00
Serhiy Storchaka 79d1c2e6c9
bpo-25711: Rewrite zipimport in pure Python. (GH-6809) 2018-09-18 22:22:29 +03:00
Steve Dower 6750922f8d
bpo-34267: Update find_python.bat to use 3.7 if available (GH-8552) 2018-09-17 14:41:53 -07:00
Steve Dower 864a892af3
bpo-34405: Updated to OpenSSL 1.1.0i for Windows builds. (GH-8775) 2018-08-15 13:29:24 -07:00
Victor Stinner 6c785c0ebd
bpo-34170: Add Python/coreconfig.c for _PyCoreConfig (GH-8607)
* Add Include/coreconfig.h
* Move config_*() and _PyCoreConfig_*() functions from Modules/main.c
  to a new Python/coreconfig.c file.
* Inline _Py_ReadHashSeed() into config_init_hash_seed()
* Move global configuration variables to coreconfig.c
2018-08-01 17:56:14 +02:00
Steve Dower f9b364fe51
bro-33614: Override exit code in find_msbuild.bat (GH-7169) 2018-05-28 14:05:05 -07:00
Steve Dower e97ba4c690
bpo-33614: Ensures module definition files for the stable ABI on Windows are correctly regenerated. (GH-7165) 2018-05-28 12:32:05 -07:00
Carl Meyer c0ee341b29 Fix Windows build of Python for latest WinSDK. (GH-6874) 2018-05-17 14:03:59 -04:00
Steve Dower e5f41d2f1e
bpo-33522: Enable CI builds on Visual Studio Team Services (#6865) 2018-05-16 17:50:29 -04:00
Steve Dower b1dc07509f
bpo-33184: Update Windows installer to OpenSSL 1.1.0h (GH-6463) 2018-04-13 17:30:34 -07:00
Steve Dower 881323db71
Minor improvements to the Windows build/release process (GH-5935) 2018-02-27 22:09:27 -08:00
Steve Dower efa6c76226
bpo-32901: Update Tcl and Tk versions to 8.6.8 (GH-5823) 2018-02-23 08:22:10 -08:00
Ivan Levkivskyi 03e3c340a0
bpo-31333: Re-implement ABCMeta in C (#5273)
This adds C versions of methods used by ABCMeta that
improve performance of various ABC operations.
2018-02-18 12:41:58 +00:00
Steve Dower 667b91a5e2
Add missing backslashes to get_externals.bat (GH-5731) 2018-02-17 19:58:57 -08:00
Steve Dower 01423cb53b
Improves the ability to build in CI (GH-5728) 2018-02-17 18:59:03 -08:00
Zachary Ware 310b05289b
bpo-32604: Make _xxsubinterpreters build on Windows (GH-5516)
This is not the ideal solution; this means that a test module is now
always included in the main python3x.dll.  However, we're already
including xxsubtype, so why not?
2018-02-11 10:43:48 -06:00
Ned Deily 5489bdad51 Start of 3.8.0a0 2018-01-31 17:44:09 -05:00
Guido van Rossum 95e4d58913 String annotations [PEP 563] (#4390)
* Document `from __future__ import annotations`
* Provide plumbing and tests for `from __future__ import annotations`
* Implement unparsing the AST back to string form

This is required for PEP 563 and as such only implements a part of the
unparsing process that covers expressions.
2018-01-26 08:20:18 -08:00
Yury Selivanov f23746a934
bpo-32436: Implement PEP 567 (#5027) 2018-01-22 19:11:18 -05:00
Steve Dower 2507e29a9e
bpo-32588: Move _findvs into its own module and add missing _queue module to installer (#5227) 2018-01-19 09:09:36 +11:00
Antoine Pitrou 94e1696d04
bpo-14976: Reentrant simple queue (#3346)
Add a queue.SimpleQueue class, an unbounded FIFO queue with a reentrant C implementation of put().
2018-01-16 00:27:16 +01:00
Steve Dower d135f20ae8
bpo-32507: Change Windows install to include app-local UCRT (#5119) 2018-01-09 19:14:46 +11:00
Zachary Ware 6c6d3a4608
Add missing backslashes in PCbuild bat files (GH-5056) 2017-12-30 17:17:36 -06:00
Benjamin Peterson e425bd7517
move pygetopt.h to internal (closes bpo-32264) (#4830) 2017-12-14 23:48:12 -08:00
INADA Naoki 7ea143ae79
bpo-29469: Move constant folding to AST optimizer (GH-2858) 2017-12-14 16:47:20 +09:00
Victor Stinner 31a8393cf6
Revert "bpo-32197: Try to fix a compiler error on OS X introduced in bpo-32030. (#4681)" (#4694)
* Revert "bpo-32197: Try to fix a compiler error on OS X introduced in bpo-32030. (#4681)"

This reverts commit 13badcbc60.

Re-apply commits:

* "bpo-32030: _PyPathConfig_Init() sets home and program_name (#4673)"
  commit af5a895073.
* "bpo-32030: Fix config_get_program_name() on macOS (#4669)"
  commit e23c06e2b0.
* "bpo-32030: Add Python/pathconfig.c (#4668)"
  commit 0ea395ae96.
* "bpo-32030: Don't call _PyPathConfig_Fini() in Py_FinalizeEx() (#4667)"
  commit ebac19dad6.
* "bpo-32030: Fix Py_GetPath(): init program_name (#4665)"
  commit 9ac3d88827.

* Fix compilation error on macOS
2017-12-04 13:39:15 +01:00
Serhiy Storchaka 13badcbc60
bpo-32197: Try to fix a compiler error on OS X introduced in bpo-32030. (#4681)
* Revert "bpo-32030: _PyPathConfig_Init() sets home and program_name (#4673)"

This reverts commit af5a895073.

* Revert "bpo-32030: Fix config_get_program_name() on macOS (#4669)"

This reverts commit e23c06e2b0.

* Revert "bpo-32030: Add Python/pathconfig.c (#4668)"

This reverts commit 0ea395ae96.

* Revert "bpo-32030: Don't call _PyPathConfig_Fini() in Py_FinalizeEx() (#4667)"

This reverts commit ebac19dad6.

* Revert "bpo-32030: Fix Py_GetPath(): init program_name (#4665)"

This reverts commit 9ac3d88827.
2017-12-02 21:36:00 +02:00
Victor Stinner 0ea395ae96
bpo-32030: Add Python/pathconfig.c (#4668)
* Factorize code from PC/getpathp.c and Modules/getpath.c to remove
  duplicated code
* rename pathconfig_clear() to _PyPathConfig_Clear()
* Inline _PyPathConfig_Fini() in pymain_impl() and then remove it,
  since it's a oneliner
2017-12-01 20:50:58 +01:00
Victor Stinner 9e87e7776f
bpo-32096: Remove obj and mem from _PyRuntime (#4532)
bpo-32096, bpo-30860:  Partially revert the commit
2ebc5ce42a:

* Move structures back from Include/internal/mem.h to
  Objects/obmalloc.c
* Remove _PyObject_Initialize() and _PyMem_Initialize()
* Remove Include/internal/pymalloc.h
* Add test_capi.test_pre_initialization_api():
   Make sure that it's possible to call Py_DecodeLocale(), and then call
   Py_SetProgramName() with the decoded string, before Py_Initialize().

PyMem_RawMalloc() and Py_DecodeLocale() can be called again before
_PyRuntimeState_Init().

Co-Authored-By: Eric Snow <ericsnowcurrently@gmail.com>
2017-11-24 12:09:24 +01:00
native-api fd0fa67464 bpo-31691: Specify where to find build instructions for the Windows installer (#4426) 2017-11-16 15:56:27 -08:00
Victor Stinner f7e5b56c37
bpo-32030: Split Py_Main() into subfunctions (#4399)
* Don't use "Python runtime" anymore to parse command line options or
  to get environment variables: pymain_init() is now a strict
  separation.
* Use an error message rather than "crashing" directly with
  Py_FatalError(). Limit the number of calls to Py_FatalError(). It
  prepares the code to handle errors more nicely later.
* Warnings options (-W, PYTHONWARNINGS) and "XOptions" (-X) are now
  only added to the sys module once Python core is properly
  initialized.
* _PyMain is now the well identified owner of some important strings
  like: warnings options, XOptions, and the "program name". The
  program name string is now properly freed at exit.
  pymain_free() is now responsible to free the "command" string.
* Rename most methods in Modules/main.c to use a "pymain_" prefix to
  avoid conflits and ease debug.
* Replace _Py_CommandLineDetails_INIT with memset(0)
* Reorder a lot of code to fix the initialization ordering. For
  example, initializing standard streams now comes before parsing
  PYTHONWARNINGS.
* Py_Main() now handles errors when adding warnings options and
  XOptions.
* Add _PyMem_GetDefaultRawAllocator() private function.
* Cleanup _PyMem_Initialize(): remove useless global constants: move
  them into _PyMem_Initialize().
* Call _PyRuntime_Initialize() as soon as possible:
  _PyRuntime_Initialize() now returns an error message on failure.
* Add _PyInitError structure and following macros:

  * _Py_INIT_OK()
  * _Py_INIT_ERR(msg)
  * _Py_INIT_USER_ERR(msg): "user" error, don't abort() in that case
  * _Py_INIT_FAILED(err)
2017-11-15 15:48:08 -08:00
Mariatta 31af650ee2
bpo-28791: Update Windows builds to use SQLite 3.21.0. (GH-4246) 2017-11-06 19:31:53 -08:00
Steve Dower 30f4fa456e
bpo-31957: Fixes version detection. (#4298) 2017-11-06 12:52:09 -08:00
Steve Dower aed0856222
bpo-31609: Fixes quotes in PCbuild/clean.bat (#4280) 2017-11-04 16:29:03 -07:00
Steve Dower 0d2a9088d1
bpo-31944: Fixes build and Modify button (#4278) 2017-11-04 16:28:47 -07:00
Steve Dower 2084b30e54 bpo-31523: Reliability improvements to the Windows build files (#3900) 2017-10-05 13:35:36 -07:00
Stefan Grönke f1502d097c bpo-31569: correct PCBuild/ case to PCbuild/ in build scripts and docs (GH-3711) 2017-09-25 17:58:10 +01:00
Steve Dower b84bcc48ae bpo-31392: Update SSL build for 1.1.0 (#3448) 2017-09-09 06:13:06 -07:00
Eric Snow 2ebc5ce42a bpo-30860: Consolidate stateful runtime globals. (#3397)
* group the (stateful) runtime globals into various topical structs
* consolidate the topical structs under a single top-level _PyRuntimeState struct
* add a check-c-globals.py script that helps identify runtime globals

Other globals are excluded (see globals.txt and check-c-globals.py).
2017-09-07 23:51:28 -06:00
Steve Dower bab21faded Updates PCBuild/readme.txt (#3418) 2017-09-07 20:10:29 -07:00
Steve Dower 05f01d8525 bpo-30389 Adds detection of VS 2017 to distutils._msvccompiler (#1632) 2017-09-07 11:49:23 -07:00
Zachary Ware d01db1c2a2 bpo-31358: Pull zlib out of the repository (GH-3375)
Also enable building externals by default on Windows, use PCbuild\build.bat's -E option to disable it.
2017-09-06 17:29:37 -07:00
Steve Dower 5d578442ed Fixes Tix build by correcting the directories used by Tcl and Tk. (#3391) 2017-09-06 13:55:42 -07:00
Steve Dower 5fcd5e64ee bpo-31340: Change to building with MSVC v141 (included with Visual Studio 2017) (#3311) 2017-09-06 10:01:38 -07:00
Eric Snow 05351c1bd8 Revert "bpo-30860: Consolidate stateful runtime globals." (#3379)
Windows buildbots started failing due to include-related errors.
2017-09-05 21:43:08 -07:00
Eric Snow 76d5abc868 bpo-30860: Consolidate stateful runtime globals. (#2594)
* group the (stateful) runtime globals into various topical structs
* consolidate the topical structs under a single top-level _PyRuntimeState struct
* add a check-c-globals.py script that helps identify runtime globals

Other globals are excluded (see globals.txt and check-c-globals.py).
2017-09-05 18:26:16 -07:00
Victor Stinner 93d0cb58b4 bpo-30947: Update libexpat from 2.2.1 to 2.2.3 (#3106)
* bpo-30947: Update libexpat from 2.2.1 to 2.2.3

* Add NEWS entry

* Add new loadlibrary.c

* expat_external.h: restore include "pyexpatns.h"

* PCbuild: add expat/loadlibrary.c

* Define XML_POOR_ENTROPY to compile expat
2017-08-18 23:43:54 +02:00
Serhiy Storchaka d5ed47dea2 bpo-30814, bpo-30876: Add new import test files to projects. (#2851) 2017-07-27 12:24:36 +03:00
Segev Finer 679b566622 bpo-9566: Fix some Windows x64 compiler warnings (#2492)
* bpo-9566: Silence liblzma warnings

* bpo-9566: Silence tcl warnings

* bpo-9566: Silence tk warnings

* bpo-9566: Silence tix warnings

* bpo-9566: Fix some library warnings

* bpo-9566: Fix msvcrtmodule.c warnings

* bpo-9566: Silence _bz2 warnings

* bpo-9566: Fixed some _ssl warnings

* bpo-9566: Fix _msi warnings

* bpo-9566: Silence _ctypes warnings

* Revert "bpo-9566: Fixed some _ssl warnings"

This reverts commit a639001c94.

* bpo-9566: Also consider NULL as a possible error in HANDLE_return_converter

* bpo-9566: whitespace fixes
2017-07-26 15:17:57 -07:00
Steve Dower 5feda33a35 bpo-30450: Fix logic for retrying nuget.exe download (#2744)
Fix logic for retrying nuget.exe download with Python.
Add support for HOST_PYTHON variable.
Clear internal environment variables used in find_python.bat
Use HOST_PYTHON as the actual Python if it is recent enough.
Adds HOST_PYTHON variable to AppVeyor configuration
2017-07-18 19:31:51 +02:00
Steve Dower efa26bcd50 bpo-30450: Fall back to git.exe if no Python is found. (#2739)
* bpo-30450: Fall back to git.exe if no Python is found.

* Also check whether git.exe is on PATH if it will be used.
2017-07-17 15:43:55 +02:00
Steve Dower 588836d3e6 bpo-30450: Adds alternate download approach for nuget.exe (#2737)
* bpo-30450: Adds alternate download approach for nuget.exe

* Whitespace fix.
2017-07-17 14:55:28 +02:00
Steve Dower 68d663cf85 [bpo-30916] Pre-build OpenSSL and Tcl/Tk for Windows (#2688)
Updates ssl and tkinter projects to use pre-built externals
2017-07-17 11:15:48 +02:00
Segev Finer 7526cadd64 bpo-30726: Also fix pyexpat.vcxproj (#2375) 2017-06-28 15:18:28 -07:00
Segev Finer 87c6555073 bpo-30726: Fix elementtree warnings on Windows due to expat upgrade (#2319)
* bpo-30726: Fix elementtree warnings on Windows

Caused by usage of `getenv` which should be safe. And a few integer
truncations which should also be ok.

* bpo-30726: Don't ignore libexpat warnings which haypo intends to fix upstream
2017-06-23 12:45:01 +02:00
Victor Stinner c8fb58bd79 bpo-30726: PCbuild _elementtree: remove duplicate defines (#2348)
bpo-30726, bpo-29591: libexpat 2.2.1 of Modules/expat/ now uses
a winconfig.h configuration file which already defines:

* XML_NS
* XML_DTD
* BYTEORDER=1234
* XML_CONTEXT_BYTES=1024
* HAVE_MEMMOVE

Remove these defines from PCbuild/_elementtree.vcxproj to prevent
compiler warnings.

Co-Authored-By: Jeremy Kloth <jeremy.kloth@gmail.com>
2017-06-23 10:09:34 +02:00
Steve Dower 40a23e8899 bpo-30687: Fixes build scripts to find msbuild.exe and stop relying on vcvarsall.bat (#2252)
* Fixes build scripts to find msbuild.exe and stop relying on vcvarsall.bat
Also fixes bdist_wininst.vcxproj to use correct version in generated name.
2017-06-19 10:34:25 -07:00
Segev Finer c9318853bb bpo-30631: Silence MSVC warnings in third-party code (GH-1963) 2017-06-15 22:12:05 -05:00
Zachary Ware 51599e2bdd bpo-30450: Pull Windows dependencies from GitHub rather than svn (GH-1783)
The Windows build now depends on Python 3.6 to fetch externals, but it will be downloaded via NuGet (which is downloaded via PowerShell) if it is not available via `py -3.6`.  This means the only thing that must be installed on a modern Windows box to do a full build of CPython with all extensions is Visual Studio.

Also fixes an outdated note about _lzma in PCbuild/readme.txt
2017-06-15 22:08:51 -05:00
Zachary Ware 6b6e687766 bpo-27425: Be more explicit in .gitattributes (GH-840)
Updates checked-in line endings on several files.
2017-06-10 14:58:42 -05:00
Steve Dower 9b33bf50da Improves test_underpth_nosite_file to reveal why it fails. (#1763)
* Improves test_underpth_nosite_file to reveal why it fails.

* Enable building with Windows 10 SDK.

* Fix WinSDK detection

* Fix initialization on Windows when a ._pth file exists.

* Fix tabs

* Adds comment about Py_GetPath call.
2017-05-23 16:25:25 -07:00
Eric Snow 6b4be195cd bpo-22257: Small changes for PEP 432. (#1728)
PEP 432 specifies a number of large changes to interpreter startup code, including exposing a cleaner C-API. The major changes depend on a number of smaller changes. This patch includes all those smaller changes.
2017-05-22 21:36:03 -07:00
Steve Dower 4486a09346 Fixes encodings in vcxproj files and adds script to automatically do it. (#1631) 2017-05-17 13:06:39 -07:00
Steve Dower 78e25ab5b3 Adds lib.pyproj file to solution (#1633)
* Adds lib.pyproj file to solution so that VS with Python support can open all the files in the standard library.

* Remove unexpected solution configuration.

* Remove lib.pyproj from solution to avoid memory issues on VS 2015.
2017-05-17 13:06:11 -07:00
Charles 8619c5417c PCbuild/build.bat: Add note about using msbuild response file. (#1551)
Using a response file will eliminate the headache associated with batch argument/quote processing.

For example I unsucessfully compiled python with visualcpptools when specifying VSInstallDir in the batch file (cannot find vcruntime.h)

```batch
build.bat -p x64 -e -M --no-tkinter  "/p:VCInstallDir=%VCInstallDir%"
```

but it build successfully when specifying it in a response file

msbuild.rsp:
```
/p:VCInstallDir=%VCInstallDir%
```
2017-05-12 16:23:15 -07:00
Charles 291557e290 PCbuild/build.bat: pass command line parameters when building PGO (#1510)
Custom msbuild properties passed as command line need to be passed too when calling `Build` when doing PGO build.
2017-05-09 23:58:48 +02:00
Segev Finer f60c9e54f5 bpo-29191: Add liblzma.vcxproj to pcbuild.sln and other missing entries (#1222)
liblzma is missing from pcbuild.sln. This causes the build of _lzma to fail when building the solution and not using build.bat.
2017-04-20 16:33:28 -07:00
Victor Stinner d6debb24e0 bpo-29919: Remove unused imports found by pyflakes (#137)
Make also minor PEP8 coding style fixes on modified imports.
2017-03-27 16:05:26 +02:00
Ned Deily 554626ada7 bpo-27593: Revise git SCM build info. (#744)
Use --short form of git hash.  Use output from "git describe" for tag.

Expected outputs:
1. previous hg
2. previous git
3. updated git

Release (tagged) build:
1. Python 3.7.0a0 (v3.7.0a0:4def2a2901a5, ...
2. Python 3.7.0a0 (v3.7.0a0^0:05f53735c8912f8df1077e897f052571e13c3496, ...
3. Python 3.7.0a0 (v3.7.0a0:05f53735c8, ...

Development build:
1. Python 3.7.0a0 (default:41df79263a11, ...
2. Python 3.7.0a0 (master:05f53735c8912f8df1077e897f052571e13c3496, ...
3. Python 3.7.0a0 (heads/master-dirty:05f53735c8, ...

"dirty" means the working tree has uncommitted changes.
See "git help describe" for more info.
2017-03-20 23:41:52 -04:00
Xiang Zhang 0710d75425 bpo-29770: remove outdated PYO related info (GH-590) 2017-03-11 13:02:52 +08:00
INADA Naoki 8886d5f392 PCbuild: Add -q option to svn export (GH-535)
Without this option, AppVeyor log is too unreadable.
2017-03-07 15:34:38 +09:00
Steve Dower 7030ca65de Fixes git command (#451) 2017-03-03 21:55:06 -08:00
Steve Dower a0c07d2edd bpo-27593: Updates Windows build to use information from git (#262)
* bpo-27593: Updates Windows build to use information from git
2017-03-03 21:20:37 -08:00
Zachary Ware fc64c351c7 bpo-29572: Update Windows build to OpenSSL 1.0.2k (GH-439) 2017-03-03 16:07:07 -06:00
Victor Stinner c22bfaae83 bpo-29524: Add Objects/call.c file (#12)
* Move all functions to call objects in a new Objects/call.c file.
* Rename fast_function() to _PyFunction_FastCallKeywords().
* Copy null_error() from Objects/abstract.c
* Inline type_error() in call.c to not have to copy it, it was only
  called once.
* Export _PyEval_EvalCodeWithName() since it is now called
  from call.c.
2017-02-12 19:27:05 +01:00
Victor Stinner d2306cec4d Backed out changeset f23fa1f7b68f
Sorry, I didn't want to push this change before the review :-( I was pushing a
change into the 2.7 branch.
2017-02-10 14:19:36 +01:00
Victor Stinner 766af559ad Issue #29465: Add Objects/call.c file
* Move all functions to call objects in a new Objects/call.c file.
* Rename fast_function() to _PyFunction_FastCallKeywords().
* Copy null_error() from Objects/abstract.c
* Inline type_error() in call.c to not have to copy it, it was only
  called once.
* Export _PyEval_EvalCodeWithName() since it is now called
  from call.c.
2017-02-10 13:32:29 +01:00
Steve Dower a558be76c2 Issue #29080: Removes hard dependency on hg.exe from PC/build.bat 2016-12-28 14:38:54 -08:00