Commit Graph

102160 Commits

Author SHA1 Message Date
Pablo Galindo fa221d804f
bpo-33083: Update "What's new" with math.factorial changes (GH-9109)
* Add elimination of non-int-like parameters in math.factorial to "What's new".
2018-09-08 00:16:17 +01:00
Pablo Galindo 5b7a2cb5ca
bpo-34246: Make sure test_smtplib always cleans resources when finished (GH-9108)
* Make sure that when some of the tests in test_smtplib fail, the allocated threads
and sockets are not leaked. 

* Use support.join_thread() instead of thread.join() to avoid infinite blocks.
2018-09-08 00:15:22 +01:00
Pablo Aguiar d5fbe9b1a3 bpo-34246: Use no mutable default args in smtplib (GH-8554)
Some methods of the SMTP class use mutable default arguments. Specially
`send_message` is affected as it mutates one of the args by appending items
to it, which has side effects on further calls.
2018-09-07 23:04:48 +01:00
Zackery Spytz 4e519377b1 bpo-23855: Add missing NULL checks for malloc() in _msi.c (GH-9038) 2018-09-08 01:02:56 +03:00
William Grzybowski 28658485a5 bpo-34604: Fix possible mojibake in pwd.getpwnam() and grp.getgrnam() (GH-9098)
Pass the user/group name as Unicode to the formatting function,
instead of always decoding a bytes string from UTF-8.
2018-09-07 19:10:39 +02:00
Victor Stinner 7e610bcdf1
bpo-34605: childs => children (GH-9102) 2018-09-07 18:13:10 +02:00
Victor Stinner 886483e2b9
bpo-34595: Add %T format to PyUnicode_FromFormatV() (GH-9080)
* Add %T format to PyUnicode_FromFormatV(), and so to
  PyUnicode_FromFormat() and PyErr_Format(), to format an object type
  name: equivalent to "%s" with Py_TYPE(obj)->tp_name.
* Replace Py_TYPE(obj)->tp_name with %T format in unicodeobject.c.
* Add unit test on %T format.
* Rename unicode_fromformat_write_cstr() to
  unicode_fromformat_write_utf8(), to make the intent more explicit.
2018-09-07 18:00:58 +02:00
Pablo Galindo 254a4663d8
bpo-20104: Add flag capabilities to posix_spawn (GH-6693)
Implement the "attributes objects" parameter of `os.posix_spawn` to complete the implementation and fully cover the underlying API.
2018-09-07 16:44:24 +01:00
Victor Stinner 5e922658fb
bpo-34605: Avoid master/slave terms (GH-9101)
* Replace "master process" with "parent process"
* Replace "master option mappings" with "main option mappings"
* Replace "master pattern object" with "main pattern object"
* ssl: replace "master" with "server"
* And some other similar changes
2018-09-07 17:30:33 +02:00
Victor Stinner 012f5b968a
bpo-34605, libregrtest: Rename --slaveargs to --worker-args (GH-9099)
Rename also run_tests_slave() to run_tests_worker().
2018-09-07 17:20:42 +02:00
William Grzybowski 23e65b2555 bpo-33625: Release GIL for grp.getgr{nam,gid} and pwd.getpw{nam,uid} (GH-7081)
Release GIL on grp.getgrnam(), grp.getgrgid(), pwd.getpwnam() and
pwd.getpwuid() if reentrant variants of these functions are available.

Patch by William Grzybowski.
2018-09-07 14:06:15 +02:00
Julien Palard 25fa141487 Doc: Missing 'f' in an f-string. (GH-9074) 2018-09-07 11:31:47 +02:00
Sergey Fedoseev f9925d86c9 _sre.c: Removed unused SRE_IS_ALNUM macro (GH-9090) 2018-09-07 10:56:09 +02:00
jdemeyer 8f735485ac bpo-25750: fix refcounts in type_getattro() (GH-6118)
When calling tp_descr_get(self, obj, type), make sure that
we own a strong reference to "self".
2018-09-07 09:37:00 +02:00
Sergey Fedoseev 593bb30e82 closes bpo-34599: Improve performance of _Py_bytes_capitalize(). (GH-9083) 2018-09-06 21:54:49 -07:00
Zackery Spytz b03c2c5190 closes bpo-34594: Don't hardcode errno values in the tests. (GH-9076) 2018-09-06 11:43:30 -07:00
Tal Einat 3e2b29dccc
bpo-30977: make uuid.UUID use __slots__ (GH-9078)
Co-Authored-By: Wouter Bolsterlee.
2018-09-06 14:34:25 +03:00
Erik Janssens 874809ea38 closes bpo-34581 : Conditionalize use of __pragma in Modules/socketmodule.c. (GH-9067) 2018-09-04 23:29:42 -07:00
Brendan Gerrity 3876af4f7c bpo-34565: Change a PC/launcher.c comment to accurately describe valid major versions. (GH-9037) 2018-09-04 09:35:46 -07:00
Alexander Buchkovsky 266f4904a2 bpo-34563: Fix for invalid assert on big output of multiprocessing.Process (GH-9027)
Fix for invalid assert on big output of multiprocessing.Process.
2018-09-04 18:10:28 +02:00
Serhiy Storchaka 7917aadb3e
bpo-26544: Add test for platform._comparable_version(). (GH-8973) 2018-09-04 15:04:25 +03:00
Victor Stinner 39487196c8
bpo-34530: Fix distutils find_executable() (GH-9049)
distutils.spawn.find_executable() now falls back on os.defpath if the
PATH environment variable is not set.
2018-09-04 11:01:09 +02:00
Pablo Galindo ec74d187f5 bpo-33613, test_semaphore_tracker_sigint: fix race condition (#7850)
Fail `test_semaphore_tracker_sigint` if no warnings are expected and one is received.

Fix race condition when the child receives SIGINT before it can register signal handlers for it.

The race condition occurs when the parent calls
`_semaphore_tracker.ensure_running()` (which in turn spawns the
semaphore_tracker using `_posixsubprocess.fork_exec`), the child
registers the signal handlers and the parent tries to kill the child.
What seem to happen is that in some slow systems, the parent sends the
signal to kill the child before the child protects against the signal.
2018-09-04 10:53:54 +02:00
Pablo Galindo e9ba3705de
bpo-33083 - Make math.factorial reject arguments that are not int-like (GH-6149)
math.factorial() was accepting non-integral Decimal instances. This is inconsistent with the actual behaviour for floats, which are not accepted.
2018-09-03 22:20:06 +01:00
Victor Stinner 65fc98e7b1
bpo-26901: Fix the Argument Clinic test suite (GH-8879)
* Fix Tools/clinic/clinic_test.py: add missing
  FakeClinic.destination_buffers attribute and pass a file argument
  to Clinic().
* Rename Tools/clinic/clinic_test.py to Lib/test/test_clinic.py:
  add temporary Tools/clinic/ to sys.path to import the clinic
  module.

Co-Authored-By: Pablo Galindo <pablogsal@gmail.com>
2018-09-03 23:17:20 +02:00
Victor Stinner 73b00becbd
bpo-34544: pymain_read_conf() don't change LC_ALL (GH-9045)
bpo-34485, bpo-34544: Again, pymain_read_conf() leaves LC_ALL locale
unchanged: only modify LC_CTYPE.
2018-09-03 17:32:31 +02:00
Victor Stinner 2094c2bea4
bpo-34567: pythoninfo gets coreconfig (GH-9043)
* Add _testcapi.get_coreconfig() to get the _PyCoreConfig of the
  interpreter
* test.pythoninfo now gets the core configuration using
  _testcapi.get_coreconfig()
2018-09-03 17:06:39 +02:00
Victor Stinner 8ea09110d4
_Py_CoerceLegacyLocale() restores LC_CTYPE on fail (GH-9044)
bpo-34544: If _Py_CoerceLegacyLocale() fails to coerce the C locale,
restore the LC_CTYPE locale to the its previous value.
2018-09-03 17:05:18 +02:00
Victor Stinner f01b2a1b84
bpo-34544: Fix setlocale() in pymain_read_conf() (GH-9041)
bpo-34485, bpo-34544: On some FreeBSD, nl_langinfo(CODESET) fails if
LC_ALL or LC_CTYPE is set to an invalid locale name. Replace
_Py_SetLocaleFromEnv(LC_CTYPE) with _Py_SetLocaleFromEnv(LC_ALL) to
initialize properly locales.

Partially revert commit 177d921c8c.
2018-09-03 14:38:21 +02:00
Raymond Hettinger f326714426
Minor improvement to code clarity (GH-9036)
Make it clear that the n==0 case is included. Otherwise, you have to know that max==0.0 whenever n==0.
2018-09-02 13:34:21 -07:00
Zachary Ware 98b976a2f8
Fix struct sequence glossary entry grammar (GH-9030)
... by removing a superfluous "either".

Reported by Никита Люшненко on docs@.
2018-09-01 20:59:27 -05:00
Thomas Herzog 2d7102e726 closes bpo-34555: Fix incorrectly nested test for HAVE_LINUX_VM_SOCKETS_H (GH-9016) 2018-09-01 15:13:57 -07:00
Tim McNamara 5265b3a98b Fix typo in typing.py module docstring (#9014)
"explicitelly" → "explicitly"
2018-09-01 09:56:58 +01:00
Michael Felt 172a71f19b bpo-34558: Add missing parentheses in _aix.py (GH-9017)
p.wait()
2018-08-31 19:31:07 -07:00
Pablo Galindo f2ef51f8be
bpo-34007: Skip traceback tests if the Program Counter is not available. (GH-9018)
Sometimes some versions of the shared libraries that are part of the
traceback are compiled in optimised mode and the Program Counter (PC)
is not present, not allowing gdb to walk the frames back. When this
happens, the Python bindings of gdb raise an exception, making the
test impossible to succeed.
2018-08-31 23:04:47 +01:00
Pablo Galindo 95d630e221
bpo-34408: Prevent a null pointer dereference and resource leakage in `PyInterpreterState_New()` (GH-8767)
* A pointer in `PyInterpreterState_New()` could have been `NULL` when being dereferenced.

* Memory was leaked in `PyInterpreterState_New()` when taking some error-handling code path.
2018-08-31 22:49:29 +01:00
Raymond Hettinger 745c0f3980
Simplify vector_norm() by eliminating special cases in the main loop (GH-9006)
The *max* value is no longer treated as a special case in the main loop.  Besides making the main loop simpler and branchless, this also lets us relax the input restriction of *vec* to contain only non-negative values.
2018-08-31 11:22:13 -07:00
Brendan Gerrity aada63b20e bpo-34062: Add missing launcher argument and make behavior consistent between short and long arguments (GH-8827)
Added previously missing "--list" argument.
Made "--list" and "--list-paths" behavior consistent with the corresponding "-0" and "-0p" arguments.
2018-08-31 08:15:42 -07:00
Steve Dower 757b73cf92
Add VSTS status badge to readme (GH-8958) 2018-08-31 08:11:35 -07:00
Marcel Plch 77b112cd56 bpo-34097: Polish API design (GH-8725)
Move strict_timestamps to constructor.
2018-08-31 16:43:31 +02:00
Naris R 1b5f9c9653 bpo-34427: Fix infinite loop when calling MutableSequence.extend() on self (GH-8813) 2018-08-30 09:56:14 -07:00
Christian Heimes e6dac00779
bpo-34542: Update test certs and keys (GH-8997)
Update all test certs and keys to use future proof crypto settings:

* 3072 bit RSA keys
* SHA-256 signature

Signed-off-by: Christian Heimes <christian@python.org>
2018-08-30 07:25:49 +02:00
Victor Stinner 0382406fcc
Fix TestPosixSpawn.test_close_file() (GH-8992)
Modify TestPosixSpawn to run Python using -I and -S options.

Disable site module to avoid side effects. For example, on Fedora 28,
if the HOME environment variable is not set, site._getuserbase()
calls pwd.getpwuid() which opens /var/lib/sss/mc/passwd, but then
leaves the file open which makes test_close_file() to fail.
2018-08-30 01:21:11 +02:00
Victor Stinner fbca90856d
bpo-34523: Use _PyCoreConfig instead of globals (GH-9005)
Use the core configuration of the interpreter, rather
than using global configuration variables. For example, replace
Py_QuietFlag with core_config->quiet.
2018-08-30 00:50:45 +02:00
Victor Stinner de42755674
bpo-34523: Py_FileSystemDefaultEncoding NULL by default (GH-9003)
* Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors
  default value is now NULL: initfsencoding() set them
  during Python initialization.
* Document how Python chooses the filesystem encoding and error
  handler.
* Add an assertion to _PyCoreConfig_Read().
2018-08-29 23:26:55 +02:00
Victor Stinner cf21504194
bpo-34485: Emit C locale coercion warning later (GH-9002)
PYTHONCOERCELOCALE=warn warning is now emitted later and written into
sys.stderr, rather than being written into the C stderr stream.
2018-08-29 22:56:06 +02:00
Victor Stinner 3d4226a832
bpo-34523: Support surrogatepass in locale codecs (GH-8995)
Add support for the "surrogatepass" error handler in
PyUnicode_DecodeFSDefault() and PyUnicode_EncodeFSDefault()
for the UTF-8 encoding.

Changes:

* _Py_DecodeUTF8Ex() and _Py_EncodeUTF8Ex() now support the
  surrogatepass error handler (_Py_ERROR_SURROGATEPASS).
* _Py_DecodeLocaleEx() and _Py_EncodeLocaleEx() now use
  the _Py_error_handler enum instead of "int surrogateescape" to pass
  the error handler. These functions now return -3 if the error
  handler is unknown.
* Add unit tests on _Py_DecodeLocaleEx() and _Py_EncodeLocaleEx()
  in test_codecs.
* Rename get_error_handler() to _Py_GetErrorHandler() and expose it
  as a private function.
* _freeze_importlib doesn't need config.filesystem_errors="strict"
  workaround anymore.
2018-08-29 22:21:32 +02:00
Victor Stinner c5989cd876
bpo-34523: Py_DecodeLocale() use UTF-8 on Windows (GH-8998)
Py_DecodeLocale() and Py_EncodeLocale() now use the UTF-8 encoding on
Windows if Py_LegacyWindowsFSEncodingFlag is zero.

pymain_read_conf() now sets Py_LegacyWindowsFSEncodingFlag in its
loop, but restore its value at exit.
2018-08-29 19:32:47 +02:00
Victor Stinner 70fead25e5
bpo-34523: Fix config_init_fs_encoding() (GH-8991)
Call config_init_fs_encoding() if filesystem_errors is not NULL but
filesystem_encoding is NULL.
2018-08-29 13:45:34 +02:00
Victor Stinner b2457efc78
bpo-34523: Add _PyCoreConfig.filesystem_encoding (GH-8963)
_PyCoreConfig_Read() is now responsible to choose the filesystem
encoding and error handler. Using Py_Main(), the encoding is now
chosen even before calling Py_Initialize().

_PyCoreConfig.filesystem_encoding is now the reference, instead of
Py_FileSystemDefaultEncoding, for the Python filesystem encoding.

Changes:

* Add filesystem_encoding and filesystem_errors to _PyCoreConfig
* _PyCoreConfig_Read() now reads the locale encoding for the file
  system encoding.
* PyUnicode_EncodeFSDefault() and PyUnicode_DecodeFSDefaultAndSize()
  now use the interpreter configuration rather than
  Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors
  global configuration variables.
* Add _Py_SetFileSystemEncoding() and _Py_ClearFileSystemEncoding()
  private functions to only modify Py_FileSystemDefaultEncoding and
  Py_FileSystemDefaultEncodeErrors in coreconfig.c.
* _Py_CoerceLegacyLocale() now takes an int rather than
  _PyCoreConfig for the warning.
2018-08-29 13:25:36 +02:00