Commit Graph

102962 Commits

Author SHA1 Message Date
Victor Stinner 8ac6539d85
bpo-35081: Add _PyTuple_CAST() (GH-10704) 2018-11-25 23:30:32 +01:00
Boštjan Mejak 158695817d closes bpo-35309: cpath should be capath (GH-10699) 2018-11-25 12:32:50 -06:00
Serhiy Storchaka 4bb186d7e2
bpo-32035: Fix words about strings and bytes in zipfile documentation. (GH-10592) 2018-11-25 09:51:14 +02:00
Julien Palard 7f4ba4afd4
Doc: Bump sphinx. (GH-10676) 2018-11-24 11:35:21 +01:00
Zackery Spytz 5b83ef71d3 bpo-35303: Fix a reference leak in _operator.c's methodcaller_repr(). (GH-10689) 2018-11-23 21:26:46 +02:00
Dustin Spicuzza 1d817e4c82 bpo-29877: compileall: import ProcessPoolExecutor only when needed (GH-4856)
Importing ProcessPoolExecutor may hang or cause an error when the import
accesses urandom on a low resource platform


https://bugs.python.org/issue29877
2018-11-23 09:06:55 -08:00
Victor Stinner 9de3632715
bpo-34812: subprocess._args_from_interpreter_flags(): add isolated (GH-10675)
The "-I" command line option (run Python in isolated mode) is now
also copied by the multiprocessing and distutils modules when
spawning child processes. Previously, only -E and -s options (enabled
by -I) were copied.

subprocess._args_from_interpreter_flags() now copies the -I flag.
2018-11-23 17:54:20 +01:00
takey ba57963a95 Linkify SMTP.quit() in smtplib documentation. (GH-9785) 2018-11-23 08:53:24 -08: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
nierob b409ffa848 bpo-35189: Retry fnctl calls on EINTR (GH-10413)
Modify the following fnctl function to retry if interrupted by a signal
(EINTR): flock, lockf, fnctl.
2018-11-23 16:46:12 +01:00
Victor Stinner f653fd4d95
bpo-35296: make install now installs the internal API (GH-10665)
make install now also installs the internal API: Include/internal/*.h
header files.
2018-11-23 16:30:12 +01:00
Mathieu Dupuy a1c4001408 Doc: Delete "how do I emulate os.kill" section in Windows FAQ (GH-10487)
That section is a tip on how to kill process on Windows for Python prior to 2.7 and 3.2.
3.1 end of support was April 2012 and 2.6 was October 2013, so that hasn't been need for supported versions of Python for more than 5 years. Beside not being needed anymore for a long time, when I read it with the eyes of a Python profane, it makes Python looks bad, like a language from the parts with warts you need to circumvent.
Let's delete that :)
2018-11-23 15:35:07 +01:00
Victor Stinner 4ac5328aff
bpo-35081: add NEWS entry for new Include/internal/pycore_*.h files (GH-10666) 2018-11-23 15:05:15 +01:00
Victor Stinner b509d52083
bpo-35059: PyObject_INIT() casts to PyObject* (GH-10674)
PyObject_INIT() and PyObject_INIT_VAR() now cast their first argument
to PyObject*, as done in Python 3.7.

Revert partially commit b4435e20a9.
2018-11-23 14:27:38 +01:00
Victor Stinner 353933e712
bpo-34523: Fix C locale coercion on FreeBSD CURRENT (GH-10672)
bpo-34523, bpo-35290: C locale coercion now resets the Python
internal "force ASCII" mode. This change fix the filesystem encoding
on FreeBSD CURRENT, which has a new "C.UTF-8" locale, when
the UTF-8 mode is disabled.

Add _Py_ResetForceASCII(): _Py_SetLocaleFromEnv() now calls it.
2018-11-23 13:08:26 +01:00
Victor Stinner e89607c0fc
bpo-35059: NEWS entry for macros converted to inline funcs (GH-10671) 2018-11-23 12:34:35 +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 3bb183d7fb
bpo-35177, Python-ast.h: Fix "Yield" compiler warning (GH-10664)
Partially revert commit 5f2df88b63e50d23914e97ec778861a52abdeaad:
add "#undef Yield" to .c files after including Python-ast.h.

Fix the warning:

    winbase.h(102): warning C4005: 'Yield': macro redefinition
2018-11-22 18:38:38 +01:00
Victor Stinner 2cf5d32fd9
bpo-9263: Fix _PyObject_Dump() for freed object (#10661)
If _PyObject_Dump() detects that the object is freed, don't try to
dump it (exit immediately).

Enhance also _PyObject_IsFreed(): it now detects if the pointer
itself looks like freed memory.
2018-11-22 16:32:57 +01:00
Victor Stinner 9a0d7a7648
bpo-24658: os.read() reuses _PY_READ_MAX (GH-10657)
os_read_impl() now also truncates the size to _PY_READ_MAX
on macOS, to avoid to allocate a larger buffer even if _Py_read() is
limited to _PY_READ_MAX bytes (ex: INT_MAX on macOS).
2018-11-22 15:03:40 +01:00
Victor Stinner 4d73ae7761
bpo-18407: ast.c uses Py_ssize_t for asdl_seq_LEN() iterator (GH-10655)
When iterating using asdl_seq_LEN(), use 'Py_ssize_t' type instead of
'int' for the iterator variable, to avoid downcast on 64-bit platforms.

_Py_asdl_int_seq_new() now also ensures that the index is greater than
or equal to 0.
2018-11-22 14:45:16 +01:00
Victor Stinner c48ff73dd6
bpo-18407: win32_urandom() uses PY_DWORD_MAX (GH-10656)
CryptGenRandom() maximum size is PY_DWORD_MAX, not INT_MAX.
Use DWORD type for the 'chunk' variable

Co-Authored-By: Jeremy Kloth <jeremy.kloth@gmail.com>
2018-11-22 14:43:07 +01:00
Victor Stinner 28f468cb19
bpo-9566: Fix compiler warnings in pyexpat.c (GH-10654)
Explicit cast a pointer difference (intptr_t) to int to fix
two warnings on 64-bit Windows:

    Modules\pyexpat.c(1181): warning C4244: 'initializing':
    conversion from '__int64' to 'int', possible  loss of data

    Modules\pyexpat.c(1192): warning C4244: 'initializing':
    conversion from '__int64' to 'int', possible  loss of data
2018-11-22 13:21:43 +01:00
Victor Stinner cdbcb773f5
cjkcodecs: Fix compiler warning (GH-10651)
Fixed the following compiler warning in multibytecodec.c:

    warning C4244: '=': conversion from 'Py_ssize_t'
    to 'unsigned char', possible loss of data

Cast Py_ssize_t to unsigned char: the maximum value is checked
on the previous line.
2018-11-22 10:25:46 +01:00
Victor Stinner a42de742e7
bpo-35059: Cast void* to PyObject* (GH-10650)
Don't pass void* to Python macros: use _PyObject_CAST().
2018-11-22 10:25:22 +01:00
Victor Stinner b37672daf6
bpo-35059: Cleanup usage of Python macros (GH-10648)
Don't pass complex expressions but regular variables to Python
macros.

* _datetimemodule.c: split single large "if" into two "if"
  in date_new(), time_new() and datetime_new().
* _pickle.c, load_extension(): flatten complex "if" expression into
  more regular C code.
* _ssl.c: addbool() now uses a temporary bool_obj to only evaluate
  the value once.
* weakrefobject.c: replace "Py_INCREF(result = proxy);"
  with "result = proxy; Py_INCREF(result);"
2018-11-22 03:37:50 +01:00
Victor Stinner 2ff8fb7639
bpo-35059: Add _PyObject_CAST() macro (GH-10645)
Add _PyObject_CAST() and _PyVarObject_CAST() macros to cast argument
to PyObject* and PyVarObject* properly.
2018-11-22 02:57:29 +01:00
Victor Stinner 271753a27a
bpo-35059: Convert _PyObject_GC_TRACK() to inline function (GH-10643)
* Add _PyObject_ASSERT_FROM() and _PyObject_ASSERT_FAILED_MSG()
  macros.
* PyObject_GC_Track() now calls _PyObject_ASSERT_FAILED_MSG(),
  instead of Py_FatalError(), if the object is already tracked, to
  dump more information on error.
* _PyObject_GC_TRACK() no longer checks if the object is already
  tracked at runtime, use an assertion instead for best performances;
  PyObject_GC_Track() still checks at runtime.
* pycore_object.h now includes pycore_pystate.h.
* Convert _PyObject_GC_TRACK() and _PyObject_GC_UNTRACK() macros to
  inline functions.
2018-11-22 01:02:54 +01:00
Victor Stinner f1d002c1e0
bpo-35059: Enhance _PyObject_AssertFailed() (GH-10642)
Enhance _PyObject_AssertFailed()

* Exchange 'expr' and 'msg' parameters
* 'expr' and 'func' arguments can now be NULL
2018-11-21 23:53:44 +01:00
Victor Stinner bcda8f1d42
bpo-35081: Add Include/internal/pycore_object.h (GH-10640)
Move _PyObject_GC_TRACK() and _PyObject_GC_UNTRACK() from
Include/objimpl.h to Include/internal/pycore_object.h.
2018-11-21 22:27:47 +01:00
Victor Stinner aac1f81eef
bpo-35189: Fix eintr_tester.py (GH-10637)
Call setitimer() before each test method, instead of once per test
case, to ensure that signals are sent in each test method.
Previously, only the first method of a testcase class got signals.

Changes:

* Replace setUpClass() with setUp() and replace tearDownClass() with
  tearDown().
* tearDown() now ensures that at least one signal has been sent.
* Replace support.run_unittest() with unittest.main() which has
  a nicer CLI and automatically discover test cases.
2018-11-21 16:33:13 +01:00
Zhiming Wang 361e8683e7 bpo-35035: Rename email.utils documentation to email.utils.rst (GH-10023)
I'll watch for 404 on the old URL and will setup an HTTP redirection if needed.
2018-11-21 13:41:07 +01:00
Victor Stinner 7c2d5702d1
bpo-35290: Add debug info to test_c_locale_coercion (GH-10631)
In verbose mode, test_c_locale_coercion now dumps global variables at
startup.
2018-11-21 12:21:25 +01:00
Julien Palard d936a8f8e0 bpo-35221: Additional hint that the placeholder is to be replaced. (GH-10604) 2018-11-21 00:40:05 -08:00
Victor Stinner 3e21ad1a25
bpo-35081: Move _PyGC_FINALIZED() back to C API (GH-10626)
Partially revert commit 1a6be91e6f,
move back PyGC API from the internal API to the C API:

* _PyGCHead_NEXT(g), _PyGCHead_SET_NEXT(g, p)
* _PyGCHead_PREV(g), _PyGCHead_SET_PREV(g, p)
* _PyGCHead_FINALIZED(g), _PyGCHead_SET_FINALIZED(g)
* _PyGC_FINALIZED(o), _PyGC_SET_FINALIZED(o)
* _PyGC_PREV_MASK_FINALIZED
* _PyGC_PREV_MASK_COLLECTING
* _PyGC_PREV_SHIFT
* _PyGC_PREV_MASK

_PyObject_GC_TRACK(o) and _PyObject_GC_UNTRACK(o) remain in the
internal API.
2018-11-21 00:43:09 +01:00
Brendan Gerrity c8fe9ccf7b bpo-34532: Fixed exit code for py.exe list versions arg (GH-9039) 2018-11-20 13:28:27 -08:00
Serhiy Storchaka b1dede3ee3
bpo-25750: Fix a compiler warning introduced in GH-9084. (GH-10234) 2018-11-20 20:45:40 +02:00
Serhiy Storchaka 3ec0f49516
bpo-35021: Fix assertion failures in _datetimemodule.c. (GH-10039)
Fixes assertion failures in _datetimemodule.c
introduced in the previous fix (see bpo-31752).

Rather of trying to handle an int subclass as exact int,
let it to use overridden special methods, but check the
result of divmod().
2018-11-20 20:41:09 +02:00
Serhiy Storchaka 97f1efb606
bpo-35169: Improve error messages for forbidden assignments. (GH-10342) 2018-11-20 19:27:16 +02:00
Serhiy Storchaka 6c48bf2d9e
bpo-9842: Add references for using "..." as a placeholder to the index. (GH-10330) 2018-11-20 19:26:09 +02:00
Julien Palard 6b73bb523a
bpo-31146: Don't fallback switcher to english on not-yet pusblished languages. (GH-10558) 2018-11-20 17:18:30 +01:00
Victor Stinner 02e6bf7f20
bpo-28604: Fix localeconv() for different LC_MONETARY (GH-10606)
locale.localeconv() now sets temporarily the LC_CTYPE locale to the
LC_MONETARY locale if the two locales are different and monetary
strings are non-ASCII. This temporary change affects other threads.

Changes:

* locale.localeconv() can now set LC_CTYPE to LC_MONETARY to decode
  monetary fields.
* Add LocaleInfo.grouping_buffer: copy localeconv() grouping string
  since it can be replaced anytime if a different thread calls
  localeconv().
* _Py_GetLocaleconvNumeric() now requires a "struct lconv *"
  structure, so locale.localeconv() now longer calls localeconv()
  twice. Moreover, the function now requires all arguments to be
  non-NULL.
* Rename STATIC_LOCALE_INFO_INIT to LocaleInfo_STATIC_INIT.
* Move _Py_GetLocaleconvNumeric() definition from fileutils.h
  to pycore_fileutils.h. pycore_fileutils.h now includes locale.h.
* The _locale module is now built with Py_BUILD_CORE defined.
2018-11-20 16:20:16 +01:00
Sanyam Khurana d5d33681c1 bpo-18859: Document --with-valgrind option in README.valgrind (#10591) 2018-11-20 12:10:49 +01:00
Donald Stufft 8b9c33ea9c
Upgrade pip to 18.1 and setuptools to 40.6.2 (#10598) 2018-11-19 07:41:52 -05:00
Zackery Spytz 062a57bf4b bpo-35269: Fix a possible segfault involving a newly-created coroutine (GH-10585)
coro->cr_origin wasn't initialized if compute_cr_origin() failed in
PyCoro_New(), which would cause a crash during the coroutine's
deallocation.



https://bugs.python.org/issue35269
2018-11-18 08:45:57 -08:00
Steve Dower 177a41a07b
bpo-34725: Adds _Py_SetProgramFullPath so embedders may override sys.executable (GH-9860) 2018-11-17 20:41:48 -08:00
Windson yang 689d555ec1 bpo-25438: document what codec PyMemberDef T_STRING decodes the char * as (GH-10580)
Source of T_STRING: e42b705188/Python/structmember.c (L51)

Source of PyUnicode_FromString
https://github.com/python/cpython/blob/master/Include/unicodeobject.h#L702


https://bugs.python.org/issue25438
2018-11-17 11:16:51 -08:00
Steve Dower 38df97a03c
Add --tempdir option for test run (GH-10322) 2018-11-17 04:14:36 -08:00
Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి) 5a087d5401 bpo-35202: Remove more unused imports in idlelib (GH-10573) 2018-11-17 01:38:01 -05:00
Stefano Rivera 338d54f0a5 bpo-28401: prevent Py_DEBUG builds from trying to import limited ABI modules (GH-1766)
[Issue 28401](https://bugs.python.org/issue28401): Don't attempt to import the stable API extensions, they are not supported in PyDEBUG builds (which don't implement that ABI).


https://bugs.python.org/issue28401
2018-11-16 15:52:52 -08:00