]> granicus.if.org Git - python/log
python
5 years agobpo-35189, bpo-35316: Make test_eintr less strict (GH-10782)
Victor Stinner [Thu, 29 Nov 2018 00:34:51 +0000 (01:34 +0100)]
bpo-35189, bpo-35316: Make test_eintr less strict (GH-10782)

test_eintr no longer fails if the signal handler has not been called.

5 years agobpo-33723: Remove busy loop from test_time (GH-10773)
Victor Stinner [Wed, 28 Nov 2018 17:30:10 +0000 (18:30 +0100)]
bpo-33723: Remove busy loop from test_time (GH-10773)

The "busy loops" of test_process_time() and test_thread_time() are
not reliable and fail randomly on Windows: remove them.

5 years agobpo-34100: compile: Re-enable frozenset merging (GH-10760)
INADA Naoki [Wed, 28 Nov 2018 15:58:46 +0000 (00:58 +0900)]
bpo-34100: compile: Re-enable frozenset merging (GH-10760)

This reverts commit 1005c84535191a72ebb7587d8c5636a065b7ed79.

5 years agobpo-35337: Fix gettmarg(): use PyStructSequence_GET_ITEM() (GH-10765)
Victor Stinner [Wed, 28 Nov 2018 14:19:51 +0000 (15:19 +0100)]
bpo-35337: Fix gettmarg(): use PyStructSequence_GET_ITEM() (GH-10765)

PyStructSequence_GET_ITEM() must be used instead of
PyTuple_GET_ITEM() on a StructTimeType.

5 years agobpo-35134: Create Include/cpython/tupleobject.h (GH-10764)
Victor Stinner [Wed, 28 Nov 2018 12:01:32 +0000 (13:01 +0100)]
bpo-35134: Create Include/cpython/tupleobject.h (GH-10764)

Move tupleobject.h code surrounded by "#ifndef Py_LIMITED_API"
to a new Include/cpython/tupleobject.h header file.

Add cpython/ header files to Makefile.pre.in and pythoncore project
of PCbuild.

5 years agobpo-34523, bpo-35322: Fix unicode_encode_locale() (GH-10759)
Victor Stinner [Wed, 28 Nov 2018 09:26:20 +0000 (10:26 +0100)]
bpo-34523, bpo-35322: Fix unicode_encode_locale() (GH-10759)

Fix memory leak in PyUnicode_EncodeLocale() and
PyUnicode_EncodeFSDefault() on error handling.

Changes:

* Fix unicode_encode_locale() error handling
* Fix test_codecs.LocaleCodecTest

5 years agobpo-35240: Add "doctest" job to Travis CI (GH-10753)
Victor Stinner [Wed, 28 Nov 2018 09:24:08 +0000 (10:24 +0100)]
bpo-35240: Add "doctest" job to Travis CI (GH-10753)

Create a new "doctest" job in Travis CI to run "make doctest".

5 years agobpo-33676: Fix dangling thread in _test_multiprocessing (GH-10755)
Victor Stinner [Wed, 28 Nov 2018 00:14:31 +0000 (01:14 +0100)]
bpo-33676: Fix dangling thread in _test_multiprocessing (GH-10755)

Fix WithThreadsTestPool.test_wrapped_exception()
of test_multiprocessing_fork: join the pool.

WithThreadsTestPool.test_del_pool() is now also decorated
with @support.reap_threads.

5 years agobpo-35134: Don't define types twice in header files (GH-10754)
Victor Stinner [Tue, 27 Nov 2018 22:54:59 +0000 (23:54 +0100)]
bpo-35134: Don't define types twice in header files (GH-10754)

Fix the following clang warning:

    Include/cpython/pystate.h:217:3: warning: redefinition of
    typedef 'PyThreadState' is a C11 feature [-Wtypedef-redefinition]

5 years agobpo-33012: Fix more invalid function cast warnings with gcc 8. (GH-10751)
Serhiy Storchaka [Tue, 27 Nov 2018 19:34:27 +0000 (21:34 +0200)]
bpo-33012: Fix more invalid function cast warnings with gcc 8. (GH-10751)

Fix warnings with gcc 8 for wrapperfunc <-> wrapperfunc_kwds casts.

5 years agobpo-35312: Make lib2to3.pgen2.parse.ParseError round-trip pickle-able. (GH-10710)
Anthony Sottile [Tue, 27 Nov 2018 18:39:49 +0000 (10:39 -0800)]
bpo-35312: Make lib2to3.pgen2.parse.ParseError round-trip pickle-able. (GH-10710)

5 years agobpo-33029: Fix signatures of getter and setter functions. (GH-10746)
Serhiy Storchaka [Tue, 27 Nov 2018 17:34:35 +0000 (19:34 +0200)]
bpo-33029: Fix signatures of getter and setter functions. (GH-10746)

Fix also return type for few other functions (clear, releasebuffer).

5 years agobpo-34100: Partially revert merge_consts_recursive() (GH-10743)
Victor Stinner [Tue, 27 Nov 2018 14:12:47 +0000 (15:12 +0100)]
bpo-34100: Partially revert merge_consts_recursive() (GH-10743)

Partically revert commit c2e1607a51d7a17f143b5a34e8cff7c6fc58a091 to
fix a reference leak.

5 years agobpo-35134: Update "make tags": add Include/cpython/ (GH-10739)
Victor Stinner [Tue, 27 Nov 2018 11:42:25 +0000 (12:42 +0100)]
bpo-35134: Update "make tags": add Include/cpython/ (GH-10739)

"make tags" and "make TAGS" now also parse Include/cpython/ header
files.

5 years agobpo-33954: Fix compiler warning in _PyUnicode_FastFill() (GH-10737)
Victor Stinner [Tue, 27 Nov 2018 11:41:17 +0000 (12:41 +0100)]
bpo-33954: Fix compiler warning in _PyUnicode_FastFill() (GH-10737)

'data' argument of unicode_fill() is modified, so it must not be
constant.

Add more assertions to unicode_fill(): check the maximum character
value.

5 years agobpo-35317: Fix mktime() error in test_email (GH-10721)
Victor Stinner [Tue, 27 Nov 2018 11:40:50 +0000 (12:40 +0100)]
bpo-35317: Fix mktime() error in test_email (GH-10721)

Fix mktime() overflow error in test_email: run
test_localtime_daylight_true_dst_true() and
test_localtime_daylight_false_dst_true() with a specific timezone.

5 years agobpo-33012: Fix invalid function cast warnings with gcc 8. (GH-6749)
Serhiy Storchaka [Tue, 27 Nov 2018 11:27:31 +0000 (13:27 +0200)]
bpo-33012: Fix invalid function cast warnings with gcc 8. (GH-6749)

Fix invalid function cast warnings with gcc 8
for method conventions different from METH_NOARGS, METH_O and
METH_VARARGS excluding Argument Clinic generated code.

5 years agobpo-33012: Fix signatures of METH_NOARGS funstions. (GH-10736)
Serhiy Storchaka [Tue, 27 Nov 2018 11:05:02 +0000 (13:05 +0200)]
bpo-33012: Fix signatures of METH_NOARGS funstions. (GH-10736)

5 years agobpo-33012: Fix invalid function cast warnings with gcc 8 in Argument Clinic. (GH...
Serhiy Storchaka [Tue, 27 Nov 2018 09:27:36 +0000 (11:27 +0200)]
bpo-33012: Fix invalid function cast warnings with gcc 8 in Argument Clinic. (GH-6748)

Fix invalid function cast warnings with gcc 8
for method conventions different from METH_NOARGS, METH_O and
METH_VARARGS in Argument Clinic generated code.

5 years agobpo-31241: Fix AST node position for list and generator comprehensions. (GH-10633)
Serhiy Storchaka [Tue, 27 Nov 2018 07:40:29 +0000 (09:40 +0200)]
bpo-31241: Fix AST node position for list and generator comprehensions. (GH-10633)

The lineno and col_offset attributes of AST nodes for list comprehensions,
generator expressions and tuples are now point to the opening parenthesis or
square brace. For tuples without parenthesis they point to the position
of the first item.

5 years agoInclude the highest pickle protocol in a couple of tests. (GH-10735)
Zackery Spytz [Tue, 27 Nov 2018 05:40:49 +0000 (22:40 -0700)]
Include the highest pickle protocol in a couple of tests. (GH-10735)

test_reduce_ex() in test_array.py and
test_reversevaluesiterator_pickling() in test_dict.py weren't using
the highest pickle protocol.

5 years agocloses bpo-34212: Build core extension modules with Py_BUILD_CORE_BUILTIN. (GH-8712)
E. M. Bray [Tue, 27 Nov 2018 02:21:31 +0000 (03:21 +0100)]
closes bpo-34212: Build core extension modules with Py_BUILD_CORE_BUILTIN. (GH-8712)

5 years agobpo-35134: Create Include/cpython/pystate.h (GH-10733)
Victor Stinner [Mon, 26 Nov 2018 23:20:00 +0000 (00:20 +0100)]
bpo-35134: Create Include/cpython/pystate.h (GH-10733)

Move pystate.h code surrounded by "#ifndef Py_LIMITED_API"
to a new Include/cpython/pystate.h header file.

5 years agobpo-35134: Create Include/cpython/dictobject.h (GH-10732)
Victor Stinner [Mon, 26 Nov 2018 23:12:26 +0000 (00:12 +0100)]
bpo-35134: Create Include/cpython/dictobject.h (GH-10732)

* Move dictobject.h code surrounded by "#ifndef Py_LIMITED_API"
  to a new Include/cpython/dictobject.h header file.
* Add PyAPI_FUNC() to _PyDictView_New().
* Reorganize dictobject.h: move views and iterators at the end.

5 years agobpo-35134: Create Include/cpython/pylifecycle.h (GH-10731)
Victor Stinner [Mon, 26 Nov 2018 23:12:05 +0000 (00:12 +0100)]
bpo-35134: Create Include/cpython/pylifecycle.h (GH-10731)

Move pylifecycle.h code surrounded by "#ifndef Py_LIMITED_API"
to a new Include/cpython/pylifecycle.h header file.

5 years agobpo-35134: Create Include/cpython/abstract.h (GH-10728)
Victor Stinner [Mon, 26 Nov 2018 21:42:04 +0000 (22:42 +0100)]
bpo-35134: Create Include/cpython/abstract.h (GH-10728)

Move abstract.h code surrounded by "#ifndef Py_LIMITED_API"
to a new Include/cpython/abstract.h header file.

5 years agobpo-35308: Fix regression where BROWSER env var is not respected. (GH-10693)
Zhiming Wang [Mon, 26 Nov 2018 21:29:45 +0000 (16:29 -0500)]
bpo-35308: Fix regression where BROWSER env var is not respected. (GH-10693)

Regression introduced in e3ce695 and 25b804a, where the old parameter
update_tryorder to _synthesize was first ignored, then given the opposite
value in the attempt to fix bpo-31014.

5 years agobpo-35134: Add Include/cpython/pyerrors.h (GH-10727)
Victor Stinner [Mon, 26 Nov 2018 21:11:25 +0000 (22:11 +0100)]
bpo-35134: Add Include/cpython/pyerrors.h (GH-10727)

Move pyerrors.h code surrounded by "#ifndef Py_LIMITED_API"
to a new Include/cpython/pyerrors.h header file.

5 years agobpo-33723: Fix test_time.test_thread_time() (GH-10724)
Victor Stinner [Mon, 26 Nov 2018 20:19:29 +0000 (21:19 +0100)]
bpo-33723: Fix test_time.test_thread_time() (GH-10724)

Tolerate up to 30 ms, instead of 15 min, in other threads.

5 years agoAdds IPv6 support when invoking http.server directly. (GH-10595)
Lisa Roach [Mon, 26 Nov 2018 18:43:38 +0000 (10:43 -0800)]
Adds IPv6 support when invoking http.server directly. (GH-10595)

5 years agobpo-35134: Create Include/cpython/unicodeobject.h (GH-10680)
Victor Stinner [Mon, 26 Nov 2018 16:29:38 +0000 (17:29 +0100)]
bpo-35134: Create Include/cpython/unicodeobject.h (GH-10680)

Move unicodeobject.h code surrounded by "#ifndef Py_LIMITED_API"
to a new Include/cpython/unicodeobject.h header file.

5 years agoDoc: Delete now useless Windows FAQ section (GH-10557)
Mathieu Dupuy [Mon, 26 Nov 2018 16:13:41 +0000 (17:13 +0100)]
Doc: Delete now useless Windows FAQ section (GH-10557)

5 years agobpo-35134: Create Include/cpython/object.h (GH-10679)
Victor Stinner [Mon, 26 Nov 2018 16:09:16 +0000 (17:09 +0100)]
bpo-35134: Create Include/cpython/object.h (GH-10679)

* Move object.h code surrounded by "#ifndef Py_LIMITED_API"
  to a new Include/cpython/object.h header file.
* "typedef struct _typeobject PyTypeObject;" is now always defined
  in object.h, but if Py_LIMITED_API is not defined,
  Include/cpython/object.h also defines the structure.
* Complete the printfunc comment to mention Py_LIMITED_API define.

5 years agopythoninfo: log more environment variable (GH-10719)
Victor Stinner [Mon, 26 Nov 2018 16:03:16 +0000 (17:03 +0100)]
pythoninfo: log more environment variable (GH-10719)

Log TZ to debug a timezone issue... and a few more :-)

5 years agobpo-33954: Fix _PyUnicode_InsertThousandsGrouping() (GH-10623)
Victor Stinner [Mon, 26 Nov 2018 12:40:01 +0000 (13:40 +0100)]
bpo-33954: Fix _PyUnicode_InsertThousandsGrouping() (GH-10623)

Fix str.format(), float.__format__() and complex.__format__() methods
for non-ASCII decimal point when using the "n" formatter.

Changes:

* Rewrite _PyUnicode_InsertThousandsGrouping(): it now requires
  a _PyUnicodeWriter object for the buffer and a Python str object
  for digits.
* Rename FILL() macro to unicode_fill(), convert it to static inline function,
  add "assert(0 <= start);" and rework its code.

5 years agoAdd assertion to _PyTuple_CAST(op) (GH-10712)
Victor Stinner [Mon, 26 Nov 2018 12:37:13 +0000 (13:37 +0100)]
Add assertion to _PyTuple_CAST(op) (GH-10712)

Add "assert(PyTuple_Check(op));" to _PyTuple_CAST() to check that the
argument is a tuple object in debug mode.

PyTuple_GET_SIZE() now uses _PyTuple_CAST() to get its assertion.

5 years agobpo-34100: Merge constants recursively (GH-8341)
INADA Naoki [Mon, 26 Nov 2018 12:23:22 +0000 (21:23 +0900)]
bpo-34100: Merge constants recursively (GH-8341)

There are some same consts in a module.  This commit merges them into
single instance.  It reduces number of objects in memory after loading modules.

https://bugs.python.org/issue34100

5 years agobpo-35313: Cleanup test_embed.py (GH-10716)
Victor Stinner [Mon, 26 Nov 2018 11:37:34 +0000 (12:37 +0100)]
bpo-35313: Cleanup test_embed.py (GH-10716)

* Remove an unused import.
* Move get_expected_config() call to check_config() to ease backport
  to Python 3.7.

5 years agobpo-35313: Fix test_embed when run from venv (GH-10713)
Victor Stinner [Mon, 26 Nov 2018 10:54:12 +0000 (11:54 +0100)]
bpo-35313: Fix test_embed when run from venv (GH-10713)

test_embed.InitConfigTests now gets the expected configuration from
a child process run with -S to not run the site module.

5 years agobpo-35300: Add usage note to the lru_cache() docs (GH-10707)
Raymond Hettinger [Mon, 26 Nov 2018 00:24:52 +0000 (16:24 -0800)]
bpo-35300: Add usage note to the lru_cache() docs (GH-10707)

https://bugs.python.org/issue35300

5 years agobpo-35081: Add Include/internal/pycore_tupleobject.h (GH-10705)
Victor Stinner [Sun, 25 Nov 2018 22:56:17 +0000 (23:56 +0100)]
bpo-35081: Add Include/internal/pycore_tupleobject.h (GH-10705)

Move _PyTuple_ITEMS() to a new header file:
Include/internal/pycore_tupleobject.h

5 years agobpo-35081: Add _PyTuple_CAST() (GH-10704)
Victor Stinner [Sun, 25 Nov 2018 22:30:32 +0000 (23:30 +0100)]
bpo-35081: Add _PyTuple_CAST() (GH-10704)

5 years agocloses bpo-35309: cpath should be capath (GH-10699)
Boštjan Mejak [Sun, 25 Nov 2018 18:32:50 +0000 (19:32 +0100)]
closes bpo-35309: cpath should be capath (GH-10699)

5 years agobpo-32035: Fix words about strings and bytes in zipfile documentation. (GH-10592)
Serhiy Storchaka [Sun, 25 Nov 2018 07:51:14 +0000 (09:51 +0200)]
bpo-32035: Fix words about strings and bytes in zipfile documentation. (GH-10592)

5 years agoDoc: Bump sphinx. (GH-10676)
Julien Palard [Sat, 24 Nov 2018 10:35:21 +0000 (11:35 +0100)]
Doc: Bump sphinx. (GH-10676)

5 years agobpo-35303: Fix a reference leak in _operator.c's methodcaller_repr(). (GH-10689)
Zackery Spytz [Fri, 23 Nov 2018 19:26:46 +0000 (12:26 -0700)]
bpo-35303: Fix a reference leak in _operator.c's methodcaller_repr(). (GH-10689)

5 years agobpo-29877: compileall: import ProcessPoolExecutor only when needed (GH-4856)
Dustin Spicuzza [Fri, 23 Nov 2018 17:06:55 +0000 (12:06 -0500)]
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

5 years agobpo-34812: subprocess._args_from_interpreter_flags(): add isolated (GH-10675)
Victor Stinner [Fri, 23 Nov 2018 16:54:20 +0000 (17:54 +0100)]
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.

5 years agoLinkify SMTP.quit() in smtplib documentation. (GH-9785)
takey [Fri, 23 Nov 2018 16:53:24 +0000 (01:53 +0900)]
Linkify SMTP.quit() in smtplib documentation. (GH-9785)

5 years agobpo-35134: Create Include/cpython/ subdirectory (GH-10624)
Victor Stinner [Fri, 23 Nov 2018 16:00:00 +0000 (17:00 +0100)]
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/.

5 years agobpo-35189: Retry fnctl calls on EINTR (GH-10413)
nierob [Fri, 23 Nov 2018 15:46:12 +0000 (16:46 +0100)]
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.

5 years agobpo-35296: make install now installs the internal API (GH-10665)
Victor Stinner [Fri, 23 Nov 2018 15:30:12 +0000 (16:30 +0100)]
bpo-35296: make install now installs the internal API (GH-10665)

make install now also installs the internal API: Include/internal/*.h
header files.

5 years agoDoc: Delete "how do I emulate os.kill" section in Windows FAQ (GH-10487)
Mathieu Dupuy [Fri, 23 Nov 2018 14:35:07 +0000 (15:35 +0100)]
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 :)

5 years agobpo-35081: add NEWS entry for new Include/internal/pycore_*.h files (GH-10666)
Victor Stinner [Fri, 23 Nov 2018 14:05:15 +0000 (15:05 +0100)]
bpo-35081: add NEWS entry for new Include/internal/pycore_*.h files (GH-10666)

5 years agobpo-35059: PyObject_INIT() casts to PyObject* (GH-10674)
Victor Stinner [Fri, 23 Nov 2018 13:27:38 +0000 (14:27 +0100)]
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 b4435e20a92af474f117b78b98ddc6f515363af5.

5 years agobpo-34523: Fix C locale coercion on FreeBSD CURRENT (GH-10672)
Victor Stinner [Fri, 23 Nov 2018 12:08:26 +0000 (13:08 +0100)]
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.

5 years agobpo-35059: NEWS entry for macros converted to inline funcs (GH-10671)
Victor Stinner [Fri, 23 Nov 2018 11:34:35 +0000 (12:34 +0100)]
bpo-35059: NEWS entry for macros converted to inline funcs (GH-10671)

5 years agobpo-35081: Add new internal headers to Makefile (GH-10670)
Victor Stinner [Fri, 23 Nov 2018 11:30:40 +0000 (12:30 +0100)]
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/.

5 years agobpo-35177, Python-ast.h: Fix "Yield" compiler warning (GH-10664)
Victor Stinner [Thu, 22 Nov 2018 17:38:38 +0000 (18:38 +0100)]
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

5 years agobpo-9263: Fix _PyObject_Dump() for freed object (#10661)
Victor Stinner [Thu, 22 Nov 2018 15:32:57 +0000 (16:32 +0100)]
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.

5 years agobpo-24658: os.read() reuses _PY_READ_MAX (GH-10657)
Victor Stinner [Thu, 22 Nov 2018 14:03:40 +0000 (15:03 +0100)]
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).

5 years agobpo-18407: ast.c uses Py_ssize_t for asdl_seq_LEN() iterator (GH-10655)
Victor Stinner [Thu, 22 Nov 2018 13:45:16 +0000 (14:45 +0100)]
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.

5 years agobpo-18407: win32_urandom() uses PY_DWORD_MAX (GH-10656)
Victor Stinner [Thu, 22 Nov 2018 13:43:07 +0000 (14:43 +0100)]
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>
5 years agobpo-9566: Fix compiler warnings in pyexpat.c (GH-10654)
Victor Stinner [Thu, 22 Nov 2018 12:21:43 +0000 (13:21 +0100)]
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

5 years agocjkcodecs: Fix compiler warning (GH-10651)
Victor Stinner [Thu, 22 Nov 2018 09:25:46 +0000 (10:25 +0100)]
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.

5 years agobpo-35059: Cast void* to PyObject* (GH-10650)
Victor Stinner [Thu, 22 Nov 2018 09:25:22 +0000 (10:25 +0100)]
bpo-35059: Cast void* to PyObject* (GH-10650)

Don't pass void* to Python macros: use _PyObject_CAST().

5 years agobpo-35059: Cleanup usage of Python macros (GH-10648)
Victor Stinner [Thu, 22 Nov 2018 02:37:50 +0000 (03:37 +0100)]
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);"

5 years agobpo-35059: Add _PyObject_CAST() macro (GH-10645)
Victor Stinner [Thu, 22 Nov 2018 01:57:29 +0000 (02:57 +0100)]
bpo-35059: Add _PyObject_CAST() macro (GH-10645)

Add _PyObject_CAST() and _PyVarObject_CAST() macros to cast argument
to PyObject* and PyVarObject* properly.

5 years agobpo-35059: Convert _PyObject_GC_TRACK() to inline function (GH-10643)
Victor Stinner [Thu, 22 Nov 2018 00:02:54 +0000 (01:02 +0100)]
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.

5 years agobpo-35059: Enhance _PyObject_AssertFailed() (GH-10642)
Victor Stinner [Wed, 21 Nov 2018 22:53:44 +0000 (23:53 +0100)]
bpo-35059: Enhance _PyObject_AssertFailed() (GH-10642)

Enhance _PyObject_AssertFailed()

* Exchange 'expr' and 'msg' parameters
* 'expr' and 'func' arguments can now be NULL

5 years agobpo-35081: Add Include/internal/pycore_object.h (GH-10640)
Victor Stinner [Wed, 21 Nov 2018 21:27:47 +0000 (22:27 +0100)]
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.

5 years agobpo-35189: Fix eintr_tester.py (GH-10637)
Victor Stinner [Wed, 21 Nov 2018 15:33:13 +0000 (16:33 +0100)]
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.

5 years agobpo-35035: Rename email.utils documentation to email.utils.rst (GH-10023)
Zhiming Wang [Wed, 21 Nov 2018 12:41:07 +0000 (07:41 -0500)]
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.

5 years agobpo-35290: Add debug info to test_c_locale_coercion (GH-10631)
Victor Stinner [Wed, 21 Nov 2018 11:21:25 +0000 (12:21 +0100)]
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.

5 years agobpo-35221: Additional hint that the placeholder is to be replaced. (GH-10604)
Julien Palard [Wed, 21 Nov 2018 08:40:05 +0000 (09:40 +0100)]
bpo-35221: Additional hint that the placeholder is to be replaced. (GH-10604)

5 years agobpo-35081: Move _PyGC_FINALIZED() back to C API (GH-10626)
Victor Stinner [Tue, 20 Nov 2018 23:43:09 +0000 (00:43 +0100)]
bpo-35081: Move _PyGC_FINALIZED() back to C API (GH-10626)

Partially revert commit 1a6be91e6fd65ce9cb88cbbbb193db7e92ec6076,
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.

5 years agobpo-34532: Fixed exit code for py.exe list versions arg (GH-9039)
Brendan Gerrity [Tue, 20 Nov 2018 21:28:27 +0000 (13:28 -0800)]
bpo-34532: Fixed exit code for py.exe list versions arg (GH-9039)

5 years agobpo-25750: Fix a compiler warning introduced in GH-9084. (GH-10234)
Serhiy Storchaka [Tue, 20 Nov 2018 18:45:40 +0000 (20:45 +0200)]
bpo-25750: Fix a compiler warning introduced in GH-9084. (GH-10234)

5 years agobpo-35021: Fix assertion failures in _datetimemodule.c. (GH-10039)
Serhiy Storchaka [Tue, 20 Nov 2018 18:41:09 +0000 (20:41 +0200)]
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().

5 years agobpo-35169: Improve error messages for forbidden assignments. (GH-10342)
Serhiy Storchaka [Tue, 20 Nov 2018 17:27:16 +0000 (19:27 +0200)]
bpo-35169: Improve error messages for forbidden assignments. (GH-10342)

5 years agobpo-9842: Add references for using "..." as a placeholder to the index. (GH-10330)
Serhiy Storchaka [Tue, 20 Nov 2018 17:26:09 +0000 (19:26 +0200)]
bpo-9842: Add references for using "..." as a placeholder to the index. (GH-10330)

5 years agobpo-31146: Don't fallback switcher to english on not-yet pusblished languages. (GH...
Julien Palard [Tue, 20 Nov 2018 16:18:30 +0000 (17:18 +0100)]
bpo-31146: Don't fallback switcher to english on not-yet pusblished languages. (GH-10558)

5 years agobpo-28604: Fix localeconv() for different LC_MONETARY (GH-10606)
Victor Stinner [Tue, 20 Nov 2018 15:20:16 +0000 (16:20 +0100)]
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.

5 years agobpo-18859: Document --with-valgrind option in README.valgrind (#10591)
Sanyam Khurana [Tue, 20 Nov 2018 11:10:49 +0000 (16:40 +0530)]
bpo-18859: Document --with-valgrind option in README.valgrind (#10591)

5 years agoUpgrade pip to 18.1 and setuptools to 40.6.2 (#10598)
Donald Stufft [Mon, 19 Nov 2018 12:41:52 +0000 (07:41 -0500)]
Upgrade pip to 18.1 and setuptools to 40.6.2 (#10598)

5 years agobpo-35269: Fix a possible segfault involving a newly-created coroutine (GH-10585)
Zackery Spytz [Sun, 18 Nov 2018 16:45:57 +0000 (09:45 -0700)]
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

5 years agobpo-34725: Adds _Py_SetProgramFullPath so embedders may override sys.executable ...
Steve Dower [Sun, 18 Nov 2018 04:41:48 +0000 (20:41 -0800)]
bpo-34725: Adds _Py_SetProgramFullPath so embedders may override sys.executable (GH-9860)

5 years agobpo-25438: document what codec PyMemberDef T_STRING decodes the char * as (GH-10580)
Windson yang [Sat, 17 Nov 2018 19:16:51 +0000 (03:16 +0800)]
bpo-25438: document what codec PyMemberDef T_STRING decodes the char * as (GH-10580)

Source of T_STRING: https://github.com/python/cpython/blob/e42b705188271da108de42b55d9344642170aa2b/Python/structmember.c#L51

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

https://bugs.python.org/issue25438

5 years agoAdd --tempdir option for test run (GH-10322)
Steve Dower [Sat, 17 Nov 2018 12:14:36 +0000 (04:14 -0800)]
Add --tempdir option for test run (GH-10322)

5 years agobpo-35202: Remove more unused imports in idlelib (GH-10573)
Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి) [Sat, 17 Nov 2018 06:38:01 +0000 (12:08 +0530)]
bpo-35202: Remove more unused imports in idlelib (GH-10573)

5 years agobpo-28401: prevent Py_DEBUG builds from trying to import limited ABI modules (GH...
Stefano Rivera [Fri, 16 Nov 2018 23:52:52 +0000 (15:52 -0800)]
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

5 years agoAdd a missed PyErr_NoMemory() in symtable_new(). (GH-10576)
Zackery Spytz [Fri, 16 Nov 2018 15:58:55 +0000 (08:58 -0700)]
Add a missed PyErr_NoMemory() in symtable_new(). (GH-10576)

This missed PyErr_NoMemory() could cause a SystemError when calling
_symtable.symtable().

5 years agobpo-35202: Remove unused imports in tests. (GH-10561)
Srinivas Thatiparthy (శ్రీనివాస్ తాటిపర్తి) [Fri, 16 Nov 2018 15:32:58 +0000 (21:02 +0530)]
bpo-35202: Remove unused imports in tests. (GH-10561)

5 years agobpo-35250: Correct argument name "num" -> "btn" in turtle docs. (GH-10565)
Srinivas Thatiparthy (శ్రీనివాస్ తాటిపర్తి) [Fri, 16 Nov 2018 13:28:51 +0000 (18:58 +0530)]
bpo-35250: Correct argument name "num" -> "btn" in turtle docs. (GH-10565)

5 years agoFix outdated info in datamodel about dicts (GH-9807)
wim glenn [Fri, 16 Nov 2018 11:58:19 +0000 (05:58 -0600)]
Fix outdated info in datamodel about dicts (GH-9807)

5 years agobpo-33816: Remove outdated metaclass example (GH-7566)
Andrés Delfino [Fri, 16 Nov 2018 11:41:55 +0000 (08:41 -0300)]
bpo-33816: Remove outdated metaclass example (GH-7566)

5 years agobpo-35239: _PySys_EndInit() copies module_search_path (GH-10532)
Victor Stinner [Fri, 16 Nov 2018 10:55:35 +0000 (11:55 +0100)]
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.

5 years agobpo-35213: Where appropriate, use 'macOS' in idlelib. (#10478)
Terry Jan Reedy [Thu, 15 Nov 2018 18:15:13 +0000 (13:15 -0500)]
bpo-35213: Where appropriate, use 'macOS' in idlelib. (#10478)

5 years agobpo-35202: Remove unused imports in Lib directory (GH-10450)
Srinivas Thatiparthy (శ్రీనివాస్ తాటిపర్తి) [Thu, 15 Nov 2018 12:59:19 +0000 (18:29 +0530)]
bpo-35202: Remove unused imports in Lib directory (GH-10450)

5 years agoFix typo in asynchronous generator iterator documentation (GH-10542)
Sebastián Ramírez [Thu, 15 Nov 2018 05:51:56 +0000 (09:51 +0400)]
Fix typo in asynchronous generator iterator documentation (GH-10542)

Remove an unnecessary "that":
... will execute that the body ... ->  ... will execute the body ...