Commit Graph

654 Commits

Author SHA1 Message Date
Manan Kumar Garg 619f98045d
Typo fix (GH-22496)
Multiple typo fixes in code comments

Automerge-Triggered-By: @Mariatta
2020-10-04 14:28:43 -07:00
Erlend Egeberg Aasland 207c321f13
bpo-40744: Drop support for SQLite pre 3.7.3 (GH-20909)
Remove code required to support SQLite pre 3.7.3.

Co-written-by: Berker Peksag <berker.peksag@gmail.com>
Co-written-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
2020-09-07 22:26:54 +01:00
Victor Stinner c45dbe93b7
bpo-41078: Add pycore_list.h internal header file (GH-21057)
* Move _PyList_ITEMS() to pycore_list.h.
* The C extension "_heapq" is now built with Py_BUILD_CORE_MODULE
  macro defined to access the internal C API.
2020-06-22 17:39:32 +02:00
Serhiy Storchaka 9355868458
bpo-41043: Escape literal part of the path for glob(). (GH-20994) 2020-06-20 11:10:31 +03:00
Victor Stinner 04fc4f2a46
bpo-40989: PyObject_INIT() becomes an alias to PyObject_Init() (GH-20901)
The PyObject_INIT() and PyObject_INIT_VAR() macros become aliases to,
respectively, PyObject_Init() and PyObject_InitVar() functions.

Rename _PyObject_INIT() and _PyObject_INIT_VAR() static inline
functions to, respectively, _PyObject_Init() and _PyObject_InitVar(),
and move them to pycore_object.h. Remove their return value:
their return type becomes void.

The _datetime module is now built with the Py_BUILD_CORE_MODULE macro
defined.

Remove an outdated comment on _Py_tracemalloc_config.
2020-06-16 01:28:07 +02:00
Pablo Galindo 1ed83adb0e
bpo-40939: Remove the old parser (GH-20768)
This commit removes the old parser, the deprecated parser module, the old parser compatibility flags and environment variables and all associated support code and documentation.
2020-06-11 17:30:46 +01:00
Ned Deily 951ab58024
Revert "bpo-26317: Support OBJC and OBJCXX configure command line variables (GH-20176)" (GH-20182)
This reverts commit 0da5466650.

The commit is causing make failures on a FreeBSD buildbot.
Due to the imminent 3.9.0b1 cutoff, revert this commit for
now pending further investigation.
2020-05-18 11:31:21 -04:00
Ned Deily 0da5466650
bpo-26317: Support OBJC and OBJCXX configure command line variables (GH-20176)
Add support to the configure script for OBJC and OBJCXX command line options so that the macOS builds can use the clang compiler for the macOS-specific Objective C source files. This allows third-party compilers, like GNU gcc, to be used to build the rest of the project since some of the Objective C system header files are not compilable by GNU gcc.

Co-authored-by: Jeffrey Kintscher <websurfer@surf2c.net>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-05-18 09:17:22 -04:00
Ned Deily 1731d6da26
bpo-34956: Fix macOS _tkinter use of Tcl/Tk in /Library/Frameworks (GH-20171)
_tkinter now builds and links with non-system Tcl and Tk frameworks if they
are installed in /Library/Frameworks as had been the case on older releases
of macOS. If a macOS SDK is explicitly configured, by using ./configure
--enable-universalsdk= or -isysroot, only a Library/Frameworks directory in
the SDK itself is searched. The default behavior can still be overridden with
configure --with-tcltk-includes and --with-tcltk-libs.
2020-05-18 04:32:38 -04:00
Chris Jerdonek da742ba826
bpo-31033: Improve the traceback for cancelled asyncio tasks (GH-19951)
When an asyncio.Task is cancelled, the exception traceback now
starts with where the task was first interrupted.  Previously,
the traceback only had "depth one."
2020-05-17 22:47:31 -07:00
Erlend Egeberg Aasland 9a45bfe6f4
bpo-35569: Expose RFC 3542 IPv6 socket options on macOS (GH-19526) 2020-05-17 02:32:46 -04:00
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
Christian Heimes 9b60e55db2
bpo-40637: Add option to disable builtin hashes (GH-20121)
Signed-off-by: Christian Heimes <christian@python.org>

Automerge-Triggered-By: @tiran
2020-05-15 14:54:53 -07:00
Joshua Root b310700976
bpo-38360: macOS: support alternate form of -isysroot flag (GH-16480)
It is possible to use either '-isysroot /some/path' (with a space) or
'-isysroot/some/path' (no space in between). Support both forms in
places where special handling of -isysroot is done, rather than just
the first form.
Co-authored-by: Ned Deily <nad@python.org>
2020-04-22 03:44:10 -04:00
Victor Stinner 9f5fe7910f
bpo-40286: Add randbytes() method to random.Random (GH-19527)
Add random.randbytes() function and random.Random.randbytes()
method to generate random bytes.

Modify secrets.token_bytes() to use SystemRandom.randbytes()
rather than calling directly os.urandom().

Rename also genrand_int32() to genrand_uint32(), since it returns an
unsigned 32-bit integer, not a signed integer.

The _random module is now built with Py_BUILD_CORE_MODULE defined.
2020-04-17 19:05:35 +02: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
Victor Stinner 65a796e527
bpo-40094: Add os.waitstatus_to_exitcode() (GH-19201)
Add os.waitstatus_to_exitcode() function to convert a wait status to an
exitcode.

Suggest waitstatus_to_exitcode() usage in the documentation when
appropriate.

Use waitstatus_to_exitcode() in:

* multiprocessing, os, subprocess and _bootsubprocess modules;
* test.support.wait_process();
* setup.py: run_command();
* and many tests.
2020-04-01 18:49:29 +02:00
Victor Stinner 6b982c22e5
bpo-40094: Add run_command() to setup.py (GH-19266) 2020-04-01 01:10:07 +02:00
Victor Stinner addaaaa946
bpo-39763: Add _bootsubprocess to build Python on AIX (GH-18872)
Add _bootsubprocess module to bootstrap Python: subprocess
implementation which only uses the os module.

On AIX, distutils.util uses _aix_support which calls
subprocess.check_output(), before the _posixsubprocess module is
built. Implement check_output() with os.system() in _bootsubprocess.
2020-03-09 23:45:59 +01:00
Victor Stinner 00c77ae55a
bpo-39763: Refactor setup.py (GH-18778)
Split long build_extensions() method into sub-methods.

Fix also a typo in Popen.wait(): replace sts with status.
2020-03-04 18:44:49 +01:00
Victor Stinner 1ec63b6203
bpo-39763: distutils.spawn now uses subprocess (GH-18743)
Reimplement distutils.spawn.spawn() function with the subprocess
module.

setup.py now uses a basic implementation of the subprocess module if
the subprocess module is not available: before required C extension
modules are built.
2020-03-04 14:50:19 +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
Dong-hee Na 0a18ee4be7 bpo-37798: Add C fastpath for statistics.NormalDist.inv_cdf() (GH-15266) 2019-08-23 15:20:30 -07:00
gescheit b9a0376b0d closes bpo-37347: Fix refcount problem in sqlite3. (GH-14268) 2019-07-12 20:15:48 -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
Benjamin Peterson 95da310078
bpo-37437: Pass -Wno-unreachable-code when compiling expat. (GH-14470) 2019-06-29 16:00:22 -07:00
Michael Felt 08970cb03c bpo-36210: update optional extension handling for AIX (GH-12202)
* Switch to officially supported curses from 3rd-party ASIS supported ncurses
* stop saying optional modules osaudiodev and spwd are missing on AIX

Patch by M.Felt
2019-06-21 23:58:00 +10:00
Ned Deily 0288dd6a51
bpo-36231: Support building on macOS without /usr/include (GH-13773) 2019-06-03 06:34:48 -04:00
Christian Heimes c7f7069e77
bpo-34271: Add ssl debugging helpers (GH-10031)
The ssl module now can dump key material to a keylog file and trace TLS
protocol messages with a tracing callback. The default and stdlib
contexts also support SSLKEYLOGFILE env var.

The msg_callback and related enums are private members. The feature
is designed for internal debugging and not for end users.

Signed-off-by: Christian Heimes <christian@python.org>
2019-05-31 11:44:05 +02:00
Charles Pigott ad0daf5b37 bpo-31525: Increase minimum sqlite version number check (GH-12923) 2019-04-26 18:38:12 +03:00
Victor Stinner 574913479f
bpo-36635, bpo-36696: Fix setup.py on AIX (GH-12922)
xlc compiler doesn't support "-D define" flag only "-Ddefine".
2019-04-23 12:26:33 +02: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
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
pxinwr 236d0b75c4 bpo-31904: Don't build the _crypt extension on VxWorks (GH-12833) 2019-04-15 11:02:20 +02:00
Christian Heimes 8abc3f4f91 bpo-36577: setup.py reports missing OpenSSL again (GH-12746)
[bpo-36146](https://bugs.python.org/issue36146) introduced another regression. In case of missing OpenSSL
libraries or headers, setup.py no longer reported _hashlib and _ssl to
be missing.

Signed-off-by: Christian Heimes <christian@python.org>



https://bugs.python.org/issue36577
2019-04-09 09:40:12 -07:00
xdegaye 2ee077f795 bpo-36544 : Fix regression introduced in bpo-36146 (GH-12708)
https://bugs.python.org/issue36544
2019-04-09 08:20:08 -07:00
Michael Felt b7eec94c0e bpo-36503: remove references to 'aix3' and 'aix4' (GH-12658) 2019-04-08 09:51:33 +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
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
Victor Stinner cfe172dc6b
bpo-36146: Add TEST_EXTENSIONS to setup.py (GH-12129)
Add TEST_EXTENSIONS constant to setup.py to allow to not build test
extensions like _testcapi.

Changes:

* Add add_ldflags_cppflags() subfunction
* Rename add_compiler_directories() to configure_compiler().
* Remove unused COMPILED_WITH_PYDEBUG constant.
* Use self.add() rather than accessing directly self.extensions.
* Remove module_enabled() function: check differently if curses
  extension is built or not.
2019-03-01 18:21:49 +01:00
Victor Stinner c991f2415d
bpo-36146: Don't run code at setup.py top level (GH-12127)
* Move set_compiler_flags() calls and concurrent.future hack from
  module top-level to main()
* Remove unused variables 'macros' and 'libraries' from
  detect_multiprocessing().
* Move SUMMARY and CLASSIFIERS constants at the top, move
  set_compiler_flags() function below these constants.
* Add some empty new lines to respect PEP 8.
2019-03-01 17:19:04 +01:00
Victor Stinner 5ec33a1c25
bpo-36146: Split setup.py into subfunctions (GH-12125)
* Split PyBuildExt.detect_modules() huge function into subfunctions.
* Move curses, hashlib and some other code to reorganize the code.
* detect_tkinter() now returns False if the extension is missing.
* Add PyBuildExt.config_h_vars attribute
2019-03-01 16:43:28 +01:00
Victor Stinner 625dbf2567
bpo-36146: Refactor setup.py: Add PyBuildExt.srcdir (GH-12124)
* Add PyBuildExt.srcdir atribute in setup.py: the source directory is
  now always absolute.
* Add PyBuildExt.inc_dirs and PyBuildExt.lib_dirs attributes:
  replace 'inc_dirs' and 'lib_dirs' local variables of
  detect_modules().
* Replace "from distutils.errors import *"
  with "from distutils.errors import CCompilerError, DistutilsError"
  to be able to use static analyzers like pyflakes
* Reorder imports.
2019-03-01 15:59:39 +01:00
Victor Stinner 8058bdae3e
bpo-36146: Refactor setup.py: PyBuildExt.add() method (GH-12097)
* Add PyBuildExt.add() which adds the extension directly to
  self.extensions, rather than using a temporary 'exts' local
  variable in detect_modules() and then add 'exts' to self.extensions
* Convert 'missing' local variable from detect_modules()
  into PyBuildExt.missing attribute
* _detect_openssl(), _decimal_ext() and _detect_nis() now call
  directly self.add(), rather than returning an extension
  (or None if not found).
* Rename _decimal_ext() to _detect_decimal() for consistency with
  other methods.
2019-03-01 15:31:45 +01:00
Victor Stinner 96d81583be
bpo-36146: Fix inc_dirs in setup.py on macOS (GH-12098)
Fix setup.py on macOS: only add /usr/include/ffi to include
directories of _ctypes, not for all extensions.
2019-03-01 13:53:46 +01:00
Victor Stinner 4cbea518a0
bpo-36146: Refactor setup.py (GH-12093)
* Rename globals to upper case to better distinguish if a variable is
  global or local:

  * Rename cross_compiling to CROSS_COMPILING
  * Rename host_platform to HOST_PLATFORM
  * Rename disabled_module_list to DISABLED_MODULE_LIST

* Add MS_WINDOWS, CYGWIN and MACOS constants.
* Use booleans: replace "return 0" with "return False"
  and replace "return 1" with "return True"
2019-02-28 17:48:38 +01:00
pxinwr 32f5fdd7f4 bpo-31904: Add cross-build support for VxWorks RTOS (GH-11968) 2019-02-27 12:09:28 +01:00
Anthony Sottile 8377cd4fcd Clean up code which checked presence of os.{stat,lstat,chmod} (#11643) 2019-02-25 23:32:27 +01:00
Neil Schemenauer 5741c45acf
bpo-35903: Use autoconfig to probe for shm_open() and shm_unlink(). (#11765)
Use autoconfig to probe for shm_open() and shm_unlink().  Set SHM_NEEDS_LIBRT if we must
link with librt to get the shm_* functions.  Change setup.py to use the autoconfig defines.  These
changes should make it more likely that _multiprocessing/posixshmem.c gets built correctly on
different platforms.
2019-02-08 10:48:46 -08:00