Commit Graph

103440 Commits

Author SHA1 Message Date
Serhiy Storchaka 9e4861f523
bpo-22831: Use "with" to avoid possible fd leaks in tests (part 1). (GH-10928) 2019-03-05 10:05:57 +02:00
Martijn Pieters b727239575 closes bpo-36188: Clean up 'unbound' method left-overs. (GH-12169)
Methods are always bound, and `__self__` can no longer be `NULL`
(`method_new()` and `PyMethod_New()` both explicitly check for this).

Moreover, once a bound method is bound, it *stays* bound and won't be re-bound
to something else, so the section in the datamodel that talks about accessing
an methods in a different descriptor-binding context doesn't apply any more in
Python 3.
2019-03-04 21:19:34 -08:00
NAKAMURA Osamu 0983fcd0d5 Doc: Use `option` word for command line interface. (GH-12142)
For command line option, `option` is better than `parameter`.
2019-03-04 20:43:43 -08:00
Victor Stinner 6dcb54228e
bpo-36142: Add _PyPreConfig_ReadFromArgv() (GH-12173)
The new function is now responsible to parse -E and -I command line
arguments.
2019-03-05 02:44:12 +01:00
Victor Stinner cad1f747da
bpo-36142: Add _PyPreConfig structure (GH-12172)
* Add _PyPreConfig structure
* Move 'ignored' and 'use_environment' fields from _PyCoreConfig
  to _PyPreConfig
* Add a new "_PyPreConfig preconfig;" field to _PyCoreConfig
2019-03-05 02:01:27 +01:00
Jules Lasne (jlasne) 7e9ce4c89e Fixed a missing . and a missing capital letter. (GH-12170) 2019-03-04 20:12:04 +02:00
Christian Heimes b7bc283ab6 bpo-36179: Fix ref leaks in _hashopenssl (GH-12158)
Fix two unlikely reference leaks in _hashopenssl. The leaks only occur in
out-of-memory cases. Thanks to Charalampos Stratakis.

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



https://bugs.python.org/issue36179
2019-03-04 07:45:41 -08:00
Kevin Adler 800d5cd750 bpo-35198 Fix C++ extension compilation on AIX (GH-10437)
For C++ extensions, distutils tries to replace the C compiler with the
C++ compiler, but it assumes that C compiler is the first element after
any environment variables set. On AIX, linking goes through ld_so_aix,
so it is the first element and the compiler is the next element. Thus
the replacement is faulty:

ld_so_aix gcc ... -> g++ gcc ...

Also, it assumed that self.compiler_cxx had only 1 element or that
there were the same number of elements as the linker has and in the
same order. This might not be the case, so instead concatenate
everything together.
2019-03-04 15:48:40 +01: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
pxinwr f4b0a1c0da bpo-31904: Add encoding support for VxWorks RTOS (GH-12051)
Use UTF-8 as the system encoding on VxWorks.

The main reason are:

1. The locale is frequently misconfigured.
2. Missing some functions to deal with locale in VxWorks C library.
2019-03-04 10:02:06 +01:00
Pablo Galindo 8bc401a55c
Clean implementation of Parser/pgen and fix some style issues (GH-12156) 2019-03-04 07:26:13 +00:00
Andrew Kuchling 97c288df61
bpo-20906: Various revisions to the Unicode howto (#8394)
* bpo-20906: Corrections & revisions to Unicode HOWTO

* bpo-34484: don't describe range as a Private Use Area
2019-03-03 23:10:28 -05:00
Woko 45d75faa72 fix typo in configparser doc (GH-12154) 2019-03-03 18:23:19 -08:00
Brennan D Baraban 8b914d2767 bpo-35899: Fix Enum handling of empty and weird strings (GH-11891)
Co-authored-by: Maxwell <maxwellpxt@gmail.com>
Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>





https://bugs.python.org/issue35899
2019-03-03 14:09:11 -08:00
Mark Williams 8b50400fbe bpo-36170: posix_spawn doesn't exist on 3.7 (GH-12143)
The 3.8 docs claim that `os.posix_spawn` was introduced in 3.7, but it wasn't; it will be introduced in 3.8.
2019-03-03 12:42:25 -05:00
Inada Naoki 8c17d928eb add missing break statement (GH-12147)
Bug introduced by 848037c.
2019-03-03 08:22:39 -08:00
native-api 45d8d2469a fixed duplicated method name of test_getuserbase() (GH-12140) 2019-03-04 01:05:19 +09:00
Henry Chen 0a6a412fb2 bpo-36091: Remove reference to async generator in Lib/types.py. (GH-11996) 2019-03-03 16:35:24 +02:00
ngie-eign 848037c147 Use names SEEK_SET, etc instead of magic number (GH-12057)
The previous code hardcoded `SEEK_SET`, etc. While it's very unlikely
that these values will change, it's best to use the definitions to avoid
there being mismatches in behavior with the code in the future.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
2019-03-03 16:28:26 +09:00
Alex Gaynor 8589f14bbe
Remove some code which has been dead since 1994 (#12136) 2019-03-01 23:37:34 -05:00
Inada Naoki 4f19030618
bpo-36103: change default buffer size of shutil.copyfileobj() (GH-12115)
It is changed from 16KiB to 64KiB.  The previous default value
is used since 1990.

coreutils chose 128 KiB as minimum buffer size for block device I/O.

But shutil.copyfileobj() can be used for non block devices.
So I choose more conservative value.

As my quick benchmark, performance difference between 64KiB and
128 KiB is up to ~5%.  On the other hand, performance difference
between 32 KiB and 64 KiB can be more than 10% when file is fully
buffered.

This is why 64 KiB is rational value.
2019-03-02 13:31:01 +09: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
Ned Deily 7eebbbd5b3 bpo-32129: Avoid blurry IDLE application icon on macOS with Tk 8.6. (GH-12031)
Patch by Kevin Walzer.
2019-03-01 17:53:50 -05:00
Stéphane Wirtel 4b219ce81e bpo-36043: FileCookieJar supports os.PathLike (GH-11945)
https://bugs.python.org/issue36043
2019-03-01 12:40:54 -08:00
Eric Snow bda918bf65
bpo-33608: Simplify ceval's DISPATCH by hoisting eval_breaker ahead of time. (gh-12062)
This includes fixes to various _Py_atomic_* macros.
2019-03-01 13:15:45 -07:00
Eric Snow b05b711a2c
bpo-33608: Use _Py_AddPendingCall() in _PyCrossInterpreterData_Release(). (gh-12024) 2019-03-01 12:35:10 -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
Xtreak be7c460fb5 bpo-35178: Fix warnings._formatwarnmsg() (GH-12033)
Ensure custom formatwarning function can receive line as positional argument.

Co-Authored-By: Tashrif Billah <tashrifbillah@gmail.com>
2019-03-01 18:17:55 +01: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 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 95e2cbf32f
bpo-36142: Move command line parsing to coreconfig.c (GH-12123)
* Add _PyCoreConfig_ReadFromArgv() function which parses command line
  options: move code from main.c to coreconfig.c.
* Add _PyCoreConfig_Write() to write the new configuration: coerce
  the LC_CTYPE locale, set Py_xxx global configuration variables,
  etc.
* _PyCoreConfig_ReadFromArgv() now only changes the LC_CTYPE locale
  temporarily. _PyCoreConfig_Write() becomes responsible to set the
  LC_CTYPE locale.
* Add _Py_SetArgcArgv() and _Py_ClearArgcArgv() functions
* Rename many "pymain_xxx()" functions
* Add "const" to some function parameters
* Reorganize main.c to declare functions in the order in which they
  are called.
2019-03-01 16:25:19 +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 62be763348
bpo-36142: Remove _PyMain structure (GH-12120)
* Move fields from _PyMain to _PyCoreConfig:

  * skip_first_line
  * run_command
  * run_module
  * run_filename

* Replace _PyMain.stdin_is_interactive with a new
  stdin_is_interactive(config) function
* Rename _PyMain to _PyArgv. Add "const _PyArgv *args" field
  to _PyCmdline.
2019-03-01 13:10:14 +01:00
Victor Stinner dfe884759d
bpo-36142: Rework error reporting in pymain_main() (GH-12113)
Add a new _Py_INIT_EXIT() macro to be able to exit Python with an
exitcode using _PyInitError API. Rewrite function calls by
pymain_main() to use _PyInitError.

Changes:

* Remove _PyMain.err and _PyMain.status field
* Add _Py_INIT_EXIT() macro and _PyInitError.exitcode field.
* Rename _Py_FatalInitError() to _Py_ExitInitError().
2019-03-01 12:14:41 +01:00
Cheryl Sabella b9f0354efc
bpo-36152: IDLE: Remove unused parameter from colorizer (GH-12109)
Remove colorizer.ColorDelegator.close_when_done and the corresponding argument of .close().  In IDLE, both have always been None or False since 2007.
2019-03-01 05:19:40 -05:00
Pablo Galindo d60a79a101
bpo-36155: Check for identity on test_gc.test_get_objects (GH-12116) 2019-03-01 01:12:27 -08:00
Raymond Hettinger 9add4b3317 bpo-36018: Add documentation link to "random variable" (GH-12114)
https://bugs.python.org/issue36018
2019-02-28 21:47:26 -08: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
Victor Stinner ab71f8b793
bpo-29571: Fix test_re.test_locale_flag() (GH-12099)
Use locale.getpreferredencoding() rather than locale.getlocale() to
get the locale encoding. With some locales, locale.getlocale()
returns the wrong encoding.

For example, on Fedora 29, locale.getlocale() returns ISO-8859-1
encoding for the "en_IN" locale, whereas
locale.getpreferredencoding() reports the correct encoding: UTF-8.
2019-03-01 00:08:03 +01:00
Raymond Hettinger ef17fdbc1c bpo-36018: Add special value tests and make minor tweaks to the docs (GH-12096)
https://bugs.python.org/issue36018
2019-02-28 09:16:25 -08:00
Zhiming Wang ae2ea33d5d Add versionadded directives to ssl.minimum_version and ssl.maximum_version (GH-11894) 2019-02-28 12:15:04 -05: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
Gregory P. Smith 4173772031
Document the surprising sideeffect PyErr_Print(). (#12081)
Did you know an API documented as printing the pending traceback would sometimes exit the process?

You do now.
2019-02-27 15:27:32 -08:00
Shiv Dhar 4064089fce Fix grammar error in timeit module docs (GH-12066)
skip issue
skip news
2019-02-27 15:21:15 -08:00
Ned Deily ccb92e814d
Update FAQ to point to Infrastructure Team website. (GH-12077) 2019-02-27 17:23:34 -05:00
Cheryl Sabella ed1deb0719
bpo-36096: IDLE: Refactor class variables in colorizer (GH-12002) 2019-02-27 08:21:16 -05:00