Commit Graph

102884 Commits

Author SHA1 Message Date
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
Zackery Spytz ad65f15581 Add a missed PyErr_NoMemory() in symtable_new(). (GH-10576)
This missed PyErr_NoMemory() could cause a SystemError when calling
_symtable.symtable().
2018-11-16 17:58:55 +02:00
Srinivas Thatiparthy (శ్రీనివాస్ తాటిపర్తి) 90d0cfb222 bpo-35202: Remove unused imports in tests. (GH-10561) 2018-11-16 17:32:58 +02:00
Srinivas Thatiparthy (శ్రీనివాస్ తాటిపర్తి) 4edeaeac4c bpo-35250: Correct argument name "num" -> "btn" in turtle docs. (GH-10565) 2018-11-16 15:28:51 +02:00
wim glenn a48e0eb967 Fix outdated info in datamodel about dicts (GH-9807) 2018-11-16 20:58:19 +09:00
Andrés Delfino c2ccac7b9f bpo-33816: Remove outdated metaclass example (GH-7566) 2018-11-16 20:41:55 +09:00
Victor Stinner 37cd982df0
bpo-35239: _PySys_EndInit() copies module_search_path (GH-10532)
* The _PySys_EndInit() function now copies the
  config->module_search_path list, so config is longer modified when
  sys.path is updated.
* config->warnoptions list and config->xoptions dict are also copied
* test_embed: InitConfigTests now also tests
  main_config['module_search_path']
* Fix _Py_InitializeMainInterpreter(): don't use config->warnoptions
   but sys.warnoptions to decide if the warnings module should
   be imported at startup.
2018-11-16 11:55:35 +01:00
Terry Jan Reedy b65413b497
bpo-35213: Where appropriate, use 'macOS' in idlelib. (#10478) 2018-11-15 13:15:13 -05:00
Srinivas Thatiparthy (శ్రీనివాస్ తాటిపర్తి) 70f61b933f bpo-35202: Remove unused imports in Lib directory (GH-10450) 2018-11-15 21:59:19 +09:00
Sebastián Ramírez 25221b3283 Fix typo in asynchronous generator iterator documentation (GH-10542)
Remove an unnecessary "that":
... will execute that the body ... ->  ... will execute the body ...
2018-11-14 21:51:56 -08:00
Pablo Galindo bfb855bef6
bpo-34784: Implement correct cleanup in PyStructSequence new implementation (GH-10536)
PyTuple_Pack can fail and return NULL. If this happens, then PyType_FromSpecWithBases will incorrectly create a new type without bases. Also, it will crash on the Py_DECREF that follows. Also free members and type in error conditions.
2018-11-15 02:03:57 +00:00
Zackery Spytz 4c596d54aa Fix a possible reference leak in _socket.getaddrinfo(). (GH-10543)
"single" needs to be decrefed if PyList_Append() fails.
2018-11-15 00:39:01 +02:00
Victor Stinner 01de89cb59
bpo-35233: InitConfigTests tests more config vars (GH-10541)
test_embed.InitConfigTests tests more configuration variables.

Changes:

* InitConfigTests tests more core configuration variables:

  * base_exec_prefix
  * base_prefix
  * exec_prefix
  * home
  * legacy_windows_fs_encoding
  * legacy_windows_stdio
  * module_search_path_env
  * prefix

* "_testembed init_from_config" tests more variables:

  * argv
  * warnoptions
  * xoptions

* InitConfigTests: add check_global_config(), check_core_config() and
  check_main_config() subfunctions to cleanup the code. Move also
  constants at the class level (ex: COPY_MAIN_CONFIG).
* Fix _PyCoreConfig_AsDict(): don't set stdio_encoding twice
* Use more macros in _PyCoreConfig_AsDict() and
  _PyMainInterpreterConfig_AsDict() to reduce code duplication.
* Other minor cleanups.
2018-11-14 17:39:45 +01:00
Julien Palard 64313478bc
bpo-32613: Update window FAQ (GH-5552) 2018-11-14 16:22:27 +01:00
INADA Naoki a757649fd6
bpo-35230: dict: Remove some macros (GH-10513)
Remove _Py_REF_DEBUG_COMMA, DK_DEBUG_INCREF, and DK_DEBUG_DECREF.
Convert DK_INCREF and DK_DECREF to static inline functions.
2018-11-14 18:39:27 +09:00
Andrés Delfino 8e0b05e2f4 Grammar corrections in abc.rst (GH-10525) 2018-11-13 16:40:44 -08:00
Andrés Delfino bf1355b424 Link to property built-in in abc.rst (GH-10526) 2018-11-13 16:29:57 -08:00
l-n-s daeb3c4c58 Fix doc typo: Window -> Windows (GH-10508) 2018-11-13 16:13:12 -08:00
Victor Stinner 7ddd56f4d8
bpo-35233: Rewrite test_embed.InitConfigTests (GH-10524)
* Fix _PyCoreConfig_SetGlobalConfig(): set also Py_FrozenFlag
* Fix _PyCoreConfig_AsDict(): export also xoptions
* Add _Py_GetGlobalVariablesAsDict() and _testcapi.get_global_config()
* test.pythoninfo: dump also global configuration variables
* _testembed now serializes global, core and main configurations
  using JSON to reuse _Py_GetGlobalVariablesAsDict(),
  _PyCoreConfig_AsDict() and _PyMainInterpreterConfig_AsDict(),
  rather than duplicating code.
* test_embed.InitConfigTests now test much more configuration
  variables
2018-11-14 00:24:28 +01:00
Gregory P. Smith 746b2d35ea
bpo-35214: Fix OOB memory access in unicode escape parser (GH-10506)
Discovered using clang's MemorySanitizer when it ran python3's
test_fstring test_misformed_unicode_character_name.

An msan build will fail by simply executing: ./python -c 'u"\N"'
2018-11-13 13:16:54 -08:00
Victor Stinner 00b137c72f
bpo-35233: Fix _PyMainInterpreterConfig_Copy() (GH-10519)
* Fix _PyMainInterpreterConfig_Copy():
   copy 'install_signal_handlers' attribute
* Add _PyMainInterpreterConfig_AsDict()
* Add unit tests on the main interpreter configuration
  to test_embed.InitConfigTests
* test.pythoninfo: log also main_config
2018-11-13 19:59:26 +01:00
Victor Stinner f966e5397e
bpo-29564:_PyMem_DumpTraceback() suggests enabling tracemalloc (GH-10510)
If tracemalloc is not tracing Python memory allocations,
_PyMem_DumpTraceback() now suggests to enable tracemalloc
to get the traceback where the memory block has been allocated.
2018-11-13 15:14:58 +01:00
Eddie Elizondo 474eedfb3d bpo-34784: Fix PyStructSequence_NewType with heap-allocated StructSequence (GH-9665) 2018-11-13 13:09:31 +01:00
Victor Stinner 1a6be91e6f
bpo-35081: Make some _PyGC macros internal (GH-10507)
* Move "GC" macros together:

  * PyObject_IS_GC()
  * _Py_AS_GC()
  * _PyObject_GC_IS_TRACKED()
  * _PyObject_GC_MAY_BE_TRACKED()

* Mark other GC macros as internal (#ifdef Py_BUILD_CORE):

  * _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)
  * _PyObject_GC_TRACK(o), _PyObject_GC_UNTRACK(o)
  * _PyGC_PREV_MASK_FINALIZED
  * _PyGC_PREV_MASK_COLLECTING
  * _PyGC_PREV_SHIFT
  * _PyGC_PREV_MASK

* Replace _PyGC_generation0 with _PyRuntime.gc.generation0
* _queuemodule.c: replace _PyObject_GC_UNTRACK()
  with with PyObject_GC_UnTrack()
* Document that  _PyObject_GC_TRACK() _PyObject_GC_UNTRACK() macros
  have been removed from the public C API.
2018-11-13 12:52:18 +01:00
Paul Ganssle 0d12672b30 bpo-35081: Remove Py_BUILD_CORE from datetime.h (GH-10416)
Datetime macros like PyDate_Check() have two implementations, one using
the C API capsule and one using direct access to the datetime type
symbols defined in _datetimemodule.c. Since the direct access versions
of the macros are only used in _datetimemodule.c, they have been moved
out of "datetime.h" and into _datetimemodule.c.

The _PY_DATETIME_IMPL macro is currently necessary in order to avoid
both duplicate definitions of these macros in _datetimemodule.c and
unnecessary declarations of C API capsule-related macros and varibles in
datetime.h.

Co-Authored-By: Victor Stinner <vstinner@redhat.com>
2018-11-13 09:02:25 +01:00
Gregory P. Smith 3015fb8ce4
bpo-35214: Add _Py_ prefix to MEMORY_SANITIZER def. (GH-10503)
Rename our new MEMORY_SANITIZER define to _Py_MEMORY_SANITIZER.
Project based C Preprocessor namespacing at its finest. :P
2018-11-12 22:01:22 -08:00
Windson yang 0dc1e45dfd Fix a couple documentation typos. (GH-10498)
reproduciblity -> reproducibility
PyPA are the group -> PyPA is the group
2018-11-12 19:56:25 -08:00
Gregory P. Smith e6c77d8301
Disable getc_unlocked() with MemorySanitizer. (GH-10499)
clang's MemorySanitizer understand getc() but does not understand
getc_unlocked().  Workaround: Don't use it on msan builds.
2018-11-12 19:47:13 -08:00
Victor Stinner 2c07c493d2
bpo-29564: warnings suggests to enable tracemalloc (GH-10486)
The warnings module now suggests to enable tracemalloc if the source
is specified, tracemalloc module is available, but tracemalloc is not
tracing memory allocations.
2018-11-13 02:41:00 +01:00