Commit Graph

103468 Commits

Author SHA1 Message Date
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
pxinwr 32f5fdd7f4 bpo-31904: Add cross-build support for VxWorks RTOS (GH-11968) 2019-02-27 12:09:28 +01:00
Joannah Nanjekye 53b9e1a1c1 bpo-36123: Fix test_socket.testWithTimeoutTriggeredSend() race condition (GH-12053)
Use longer timeout for accept() in the server and block on accept in the client.
The client now only sets the timeout once the socket is connected.
2019-02-26 17:18:23 +01:00
Giampaolo Rodola c606a9cbd4
bpo-35652: shutil.copytree(copy_function=...) erroneously pass DirEntry instead of path str (GH-11997) 2019-02-26 12:04:41 +01:00
Benjamin Peterson d5a551c269 closes bpo-36115: Fix some reference leaks in typeobject.c. (GH-12045)
a24107b04c introduced a few refleaks.





https://bugs.python.org/issue36115
2019-02-25 23:12:10 -08:00
Dima Pasechnik f57cd8288d bpo-36106: Resolve sinpi name clash with libm (IEEE-754 violation). (GH-12027)
The standard math library (libm) may follow IEEE-754 recommendation to
include an implementation of sinPi(), i.e. sinPi(x):=sin(pi*x).
And this triggers a name clash, found by FreeBSD developer
Steve Kargl, who worken on putting sinpi into libm used on FreeBSD
(it has to be named "sinpi", not "sinPi", cf. e.g.
https://en.cppreference.com/w/c/experimental/fpext4).
2019-02-26 08:36:11 +02:00
Serhiy Storchaka ff3d39faa8 bpo-36109: Fix random test_descr failure. (GH-12044) 2019-02-25 22:03:21 -08:00
Benjamin Peterson b84df2d7cc Run autoreconf. 2019-02-25 21:37:59 -08:00
ngie-eign 90c6facebd closes bpo-13497: Fix `broken nice` configure test. (GH-12041)
Per POSIX, `nice(3)` requires `unistd.h` and `exit(3)` requires `stdlib.h`.

Fixing the test will prevent false positives with pedantic compilers like clang.
2019-02-25 21:34:24 -08:00
Zackery Spytz 6673decfa0 bpo-24643: Fix "#define timezone _timezone" clashes on Windows (GH-12019) 2019-02-25 15:56:44 -08:00
Davin Potts aadef2b416
bpo-36102: Prepend slash to all POSIX shared memory block names (#12036) 2019-02-25 16:41:52 -06:00
Anthony Sottile 8377cd4fcd Clean up code which checked presence of os.{stat,lstat,chmod} (#11643) 2019-02-25 23:32:27 +01:00
Xtreak 9c3f284de5 Autospec functions should propagate mock calls to parent GH-11273 2019-02-25 21:46:34 +00:00
Sergey Fedoseev f1b9abe35f bpo-36030: Remove _PyStack_AsTuple() and _PyStack_AsTupleSlice() (GH-12032) 2019-02-25 22:37:26 +01:00
Łukasz Langa b5853e2650
Post v3.8.0a2 2019-02-25 21:08:21 +01:00
Łukasz Langa 3025a7eebc Python 3.8.0a2
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAlxz2v0ACgkQsmmV4xAl
 BWjC4g/+OlySJwyU24YgF8XHihQiDSBwFGXgjdQ+KewOLbgCOofftXvEjhlozHVJ
 YxCiAGBPeFOUpsBZL1OHtihHSEYMS/XsGGWe/MKU+LaVtNnrLZAIFdX9uMkpfebg
 5Ndjs9PY5afxV0+QRfm0gz65V2JdHk4XuTbt5TUcji2i1rB021LKRXwnqex2R7Ly
 Mnwhmo/BDyT2t1+LYNEjBQ3QIQWZ9g/WbXdhRvxfccydVzwk9YX40g3yx0LkokDY
 Ej8AMk5A/A7a7gHOJebVqyLPbsg1rIfFe8r0JvCftH3YEQIshpbUgZsZCExgOsLm
 mGehPnOfc1D1mAKiWoDgm52+u9ae+IcxfktYM+spiUY69mQhwOhigPpfdUfZngW9
 H5sRu9dq9+KmDGrOb3jDY4coUiXnaRuGMcfosGqm+Q7gJXoRxE4zljVJwRdQpPea
 xpVeb4W3q58bfv+R60C88wuwv6OjdE0rL9VKLXndCoHV3YZTexS162S6d00rOOhB
 wYBViTxSh42+lUqn8CWJFDUQFnbTj2zArCMpDjIIDTWvWJEEczhEwKgDW7l5/sZE
 UOEm1xwn+3258gsxzPDRn1mZM99X1OyLx/hnSfAU2mv/2NFKRXYWgAmIhXtQqLHi
 t3BxwVgruP/yhswrPTf0Wz3RfZh4KH/5SH75O0YTykdzKMyPFIQ=
 =21b3
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAlx0SwkQHGx1a2FzekBs
 YW5nYS5wbAAKCRCyaZXjECUFaDW3D/9OM6xt4MNsIuRLfqI7NEqt6HRFrk96CCyW
 ++QPk+hKXKmRDNFRiriJoAZjCJRjvY7wqrt3dbJfVkKYnBvyxPCO+9rLgcI/J71G
 Wyi+mcm4TeVl5YfTFN9+/Y7rA3upcrGQsr/3eYDtT2y1x3XmxmpniwKNWyTDSMDg
 7lEwANLVj5u2FTojQjZHNVfc8D+V0w676s2IfGcIm8COckY+w1ti9QLF8qgLshAg
 ocEW8CKYF4S69QyYwngNiheGdO423kmAxOyWMCeWBdS5jq6wMmMIG9H31P35RdEi
 QtSkhq6sSabt+IwTYTe/SjxFXmSh8NgbnKJkgq3w33iEuNr1SVc3vCak+sDYtV6N
 dtyYUtYU+fqyrbhMP2bC0TR9T0aV63EXXXRAnhgIR0ZF3AtsnuLoqsWuhtobwypb
 DWem1jhhDywqZib1SCdgDBbW943yqcd86slC2cVlZzZi8odUKP6Lz6kSIadtWItb
 IKrSc8XCJ9J/1Kl1LxBtrm2IWBlH1VB+VHyT8lxuYR6NRrcFVzTIZBAjWtdUsE16
 hZocozrbkQkDPUs2qMkt6Op17dAfhb5geb7QdEsmTiMaiMYtESx7tmA5kihs7gkC
 QMPtPMQMFmPCnd8iE4W8kEKvHr+g7xbGU9JWUpAZomWZrzj6OnsCfVQRi8kmMZ+V
 RsFLW7aLLA==
 =MEsg
 -----END PGP SIGNATURE-----

Merge tag 'v3.8.0a2'

Python 3.8.0a2
2019-02-25 21:07:31 +01:00
Sergey Fedoseev 234531b446 bpo-36030: Add _PyTuple_FromArray() function (GH-11954) 2019-02-25 17:59:12 +01:00
Andre Delfino 55e335d7d5 Remove empty Dictionaries section from programming FAQ (GH-12026) 2019-02-25 11:22:07 -05:00
Serhiy Storchaka a24107b04c
bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112) 2019-02-25 17:59:46 +02:00
Serhiy Storchaka a180b007d9
bpo-28450: Fix and improve the documentation for unknown escapes in RE. (GH-11920) 2019-02-25 17:58:30 +02:00
Serhiy Storchaka 6a44f6eef3
bpo-36048: Use __index__() instead of __int__() for implicit conversion if available. (GH-11952)
Deprecate using the __int__() method in implicit conversions of Python
numbers to C integers.
2019-02-25 17:57:58 +02:00
Sergey Fedoseev d90a141bb9 Correct name of 'defaultobj' parameter in PyDict_SetDefault() signature. (GH-11929) 2019-02-25 16:52:40 +02:00
Łukasz Langa 23f4589b4b
v3.8.0a2 2019-02-25 13:08:32 +01:00