Commit Graph

104110 Commits

Author SHA1 Message Date
Mario Corchero 0df635c7f8 Don't report deleted attributes in __dir__ (GH#10148)
When an attribute is deleted from a Mock, a sentinel is added rather
than just deleting the attribute. This commit checks for such sentinels
when returning the child mocks in the __dir__ method as users won't
expect deleted attributes to appear when performing dir(mock).
2019-04-30 19:56:36 +01:00
Steve Dower d537ab0ff9
bpo-36742: Fixes handling of pre-normalization characters in urlsplit() (GH-13017) 2019-04-30 12:03:02 +00:00
Victor Stinner b84cb70880
bpo-36734: Fix compilation of faulthandler.c on HP-UX (GH-12970)
Initialize "stack_t current_stack" to zero using memset().
2019-04-30 12:19:34 +02:00
gescheit 3bbcc92577 bpo-25430: improve performance of IPNetwork.__contains__ (GH-1785)
make a compare in bit-operation manner.
2019-04-30 16:54:30 +09:00
Raymond Hettinger b0a2c0fa83
bpo-36018: Test idempotence. Test two methods against one-another. (GH-13021) 2019-04-29 23:47:33 -07:00
Utkarsh Gupta ee0309f3d8 closes bpo-35329: Change 'Package' to 'package' in accordance with PEP8. (GH-13008) 2019-04-29 19:20:06 -07:00
Pablo Galindo d5d2b45469
bpo-36751: Deprecate getfullargspec and report positional-only args as regular args (GH-13016)
* bpo-36751: Deprecate getfullargspec and report positional-only args as regular args

* Use inspect.signature in testhelpers
2019-04-30 02:01:14 +01:00
Marco Rougeth 81c5a90595 bpo-36232: Improve error message on dbm.open() when the db doesn't exist (GH-12060) 2019-04-29 16:23:28 -07:00
Ned Deily 9bdd6d1c2a
Prevent macOS installer build failure if ABIFLAGS is empty. (GH-13012) 2019-04-29 15:11:53 -04:00
Ned Deily 883dfc668f
bpo-34602: Avoid failures setting macOS stack resource limit (GH-13011)
Under some conditions the earlier fix for bpo-18075, "Infinite recursion
tests triggering a segfault on Mac OS X", now causes failures on macOS
when attempting to change stack limit with resource.setrlimit
resource.RLIMIT_STACK, like regrtest does when running the test suite.
The reverted change had specified a non-default stack size when linking
the python executable on macOS.  As of macOS 10.14.4, the previous
code causes a hard failure when running tests, although similar
failures had been seen under some conditions under some earlier
systems.  For now, revert the original change and resume using
the default stack size when linking the interpreter.
2019-04-29 15:07:39 -04:00
Berker Peksag be6dbfb43b
bpo-1613500: Don't hardcode output file mode in fileinput.FileInput (GH-12986) 2019-04-29 17:55:39 +03:00
Paul Ganssle 88c0937056 bpo-36004: Add date.fromisocalendar (GH-11888)
This commit implements the first version of date.fromisocalendar, the
inverse function for date.isocalendar.
2019-04-29 15:22:03 +02:00
xdegaye a86e06433a bpo-35952: Fix test.pythoninfo when the compiler is missing (GH-13007) 2019-04-29 14:53:30 +02:00
Guido van Rossum 843bf42aa6 Add initial 'whatsnew' section for PEP 570 (GH-12942) 2019-04-29 13:49:29 +01:00
Pablo Galindo 8c77b8cb91
bpo-36540: PEP 570 -- Implementation (GH-12701)
This commit contains the implementation of PEP570: Python positional-only parameters.

* Update Grammar/Grammar with new typedarglist and varargslist

* Regenerate grammar files

* Update and regenerate AST related files

* Update code object

* Update marshal.c

* Update compiler and symtable

* Regenerate importlib files

* Update callable objects

* Implement positional-only args logic in ceval.c

* Regenerate frozen data

* Update standard library to account for positional-only args

* Add test file for positional-only args

* Update other test files to account for positional-only args

* Add News entry

* Update inspect module and related tests
2019-04-29 13:36:57 +01:00
Victor Stinner 99fcc616d4
Revert "bpo-36356: Destroy the GIL at exit (GH-12453)" (GH613006)
This reverts commit b36e5d627d.
2019-04-29 13:04:07 +02:00
Victor Stinner b36e5d627d
bpo-36356: Destroy the GIL at exit (GH-12453)
* Add _PyEval_FiniThreads2(). _PyEval_FiniThreads() now only clears
  the pending lock, whereas _PyEval_FiniThreads2() destroys the GIL.
* pymain_free() now calls _PyEval_FiniThreads2().
* Py_FinalizeEx() now calls _PyEval_FiniThreads().
2019-04-29 11:15:56 +02:00
xdegaye 7a5a1cfe04 bpo-36747: Remove the stale scriptsinstall Makefile target (GH-13003) 2019-04-29 11:01:42 +02:00
Joannah Nanjekye f781d202a2 bpo-36475: Finalize PyEval_AcquireLock() and PyEval_AcquireThread() properly (GH-12667)
PyEval_AcquireLock() and PyEval_AcquireThread() now
terminate the current thread if called while the interpreter is
finalizing, making them consistent with PyEval_RestoreThread(),
Py_END_ALLOW_THREADS, and PyGILState_Ensure().
2019-04-29 10:38:45 +02:00
xdegaye 254b309c80 bpo-21536: On Android, C extensions are linked to libpython (GH-12989) 2019-04-29 09:27:40 +02:00
Andrey b021ba5028 Fix typo in 'tandem' word (GH-12998) (GH-12998) 2019-04-28 21:33:26 -07:00
Raymond Hettinger db81ba1393
bpo-36546: More tests: type preservation and equal inputs (#13000) 2019-04-28 21:31:55 -07:00
Emmanuel Arias 86f0c8215c bpo-36729: Delete unused text variable on tests. (GH-12959) 2019-04-29 05:24:24 +03:00
Zackery Spytz e0dcb85b7d bpo-36745: Fix a possible reference leak in PyObject_SetAttr() (GH-12993)
https://bugs.python.org/issue36745
2019-04-28 05:58:52 -07:00
Raymond Hettinger da63b321f6
bpo-36715: Add usage note for dict.fromkeys() (GH-12974) 2019-04-28 00:22:36 -07:00
Gordon P. Hemsley 50fed0b64f bpo-32424: Improve test coverage for xml.etree.ElementTree (GH-12891)
* Fix typo in test_cyclic_gc subtest
* Improve test coverage for xml.etree.ElementTree
2019-04-28 06:41:43 +02:00
Berker Peksag 21a9ba1992
bpo-2091: Fix typo in exception message (GH-12987) 2019-04-27 22:40:45 +03:00
Paul Ganssle 4d8c8c0ad6 bpo-36025: Fix PyDate_FromTimestamp API (GH-11922)
In the process of converting the date.fromtimestamp function to use
argument clinic in GH-8535, the C API for PyDate_FromTimestamp was
inadvertently changed to expect a timestamp object rather than an
argument tuple.

This PR fixes this backwards-incompatible change by adding a new wrapper
function for the C API function that unwraps the argument tuple and
passes it to the underlying function.

This PR also adds tests for both PyDate_FromTimestamp and
PyDateTime_FromTimestamp to prevent any further regressions.
2019-04-27 22:39:40 +03:00
Paul Ganssle 5c403b2035 bpo-36722: Style and grammar edits for ABI news entries (GH-12979) 2019-04-27 20:14:35 +02:00
Terry Jan Reedy 55d035113d
Syntax highlight IDLE html doc code example. (GH-12981)
The new markup is currently ignored by IDLE's tk doc display.
2019-04-26 23:22:36 -04:00
Victor Stinner 6d13e5b35b
bpo-36722: Don't define ALT_SOABI for Py_TRACE_REFS build (GH-12973)
Py_TRACE_REFS ABI is incompatible with release and debug (Py_DEBUG)
ABI.
2019-04-26 18:56:19 +02:00
Victor Stinner 4046069740
bpo-36722: Add What's New entry for debug ABI (GH-12957) 2019-04-26 17:56:44 +02:00
Victor Stinner 01f073f5e4
bpo-21536: Revert Makefile change on python-config (GH-12971)
Misc/python-config.sh lives in the build directory, not in the source
directory.
2019-04-26 17:55:17 +02:00
Charles Pigott ad0daf5b37 bpo-31525: Increase minimum sqlite version number check (GH-12923) 2019-04-26 18:38:12 +03:00
Victor Stinner 06d04e77ca
bpo-36733: Fix PYTHONPATH for make regen-add (GH-12969)
Add PYTHONPATH=$(srcdir) to run $(PYTHON_FOR_REGEN) -m Parser.pgen,
so it's possible to build Python from a different directory.
2019-04-26 13:09:47 +02:00
Victor Stinner 4cb525a1f0
bpo-36356: pymain_exit_error() only call pymain_free() for exit (GH-12968)
Add _Py_INIT_HAS_EXITCODE() macro.
2019-04-26 13:05:47 +02:00
Victor Stinner 00db7c73af
bpo-36719: regrtest closes explicitly WindowsLoadTracker (GH-12965)
Regrtest.finalize() now closes explicitly the WindowsLoadTracker
instance.
2019-04-26 11:12:26 +02:00
Victor Stinner 837acc1957
bpo-36719: Fix regrtest re-run (GH-12964)
Properly handle a test which fail but then pass.

Add test_rerun_success() unit test.
2019-04-26 09:56:37 +02:00
Victor Stinner 75120d2205
bpo-36719: regrtest always detect uncollectable objects (GH-12951)
regrtest now always detects uncollectable objects. Previously, the
check was only enabled by --findleaks. The check now also works with
-jN/--multiprocess N.

--findleaks becomes a deprecated alias to --fail-env-changed.
2019-04-26 09:28:53 +02:00
Mark Dickinson 7abb6c05af
bpo-36669: add matmul support to weakref.proxy (GH-12932) 2019-04-26 15:56:15 +09:00
Victor Stinner 3cde440f20
bpo-36725: Refactor regrtest multiprocessing code (GH-12961)
Rewrite run_tests_multiprocess() function as a new MultiprocessRunner
class with multiple methods to better report errors and stop
immediately when needed.

Changes:

* Worker processes are now killed immediately if tests are
  interrupted or if a test does crash (CHILD_ERROR): worker
  processes are killed.
* Rewrite how errors in a worker thread are reported to
  the main thread. No longer ignore BaseException or parsing errors
  silently.
* Remove 'finished' variable: use worker.is_alive() instead
* Always compute omitted tests. Add Regrtest.get_executed() method.
2019-04-26 08:40:25 +02:00
Victor Stinner 87d23a041d
bpo-36724: Add _PyWarnings_Fini() (#12963)
Py_FinalizeEx() now clears _PyRuntime.warnings variables and
_PyRuntime.exitfuncs.

Changes:

* Add _PyWarnings_Fini(): called by Py_FinalizeEx()
* call_ll_exitfuncs() now clears _PyRuntime.exitfuncs while iterating
  on it (on backward order).
2019-04-26 05:49:26 +02:00
Victor Stinner 99e69d44f4
bpo-36710: Fix compiler warning on PyThreadState_Delete() (GH-12962)
_PyThreadState_Delete() has no return value.
2019-04-26 05:48:51 +02:00
Victor Stinner 4d29983185
bpo-36725: regrtest: add TestResult type (GH-12960)
* Add TestResult and MultiprocessResult types to ensure that results
  always have the same fields.
* runtest() now handles KeyboardInterrupt
* accumulate_result() and format_test_result() now takes a TestResult
* cleanup_test_droppings() is now called by runtest() and mark the
  test as ENV_CHANGED if the test leaks support.TESTFN file.
* runtest() now includes code "around" the test in the test timing
* Add print_warning() in test.libregrtest.utils to standardize how
  libregrtest logs warnings to ease parsing the test output.
* support.unload() is now called with abstest rather than test_name
* Rename 'test' variable/parameter to 'test_name'
* dash_R(): remove unused the_module parameter
* Remove unused imports
2019-04-26 04:08:53 +02:00
Victor Stinner 9db0324712
bpo-36710: Add runtime parameter in gcmodule.c (GH-12958)
Add 'state' or 'runtime' parameter to functions in gcmodule.c to
avoid to rely directly on the global variable _PyRuntime.
2019-04-26 02:32:01 +02:00
Victor Stinner 10c8e6af91
bpo-36710: Add runtime variable in pystate.c (GH-12956)
Add 'gilstate', 'runtime' or 'xidregistry' parameter to many
functions on pystate.c to avoid lying on _PyRuntime global.
2019-04-26 01:53:18 +02:00
Victor Stinner 5422e3cfb7
bpo-36722: Debug build loads libraries built in release mode (GH-12952)
In debug build, import now also looks for C extensions compiled in
release mode and for C extensions compiled in the stable ABI.
2019-04-26 01:40:00 +02:00
Paul Monson 62dfd7d6fe bpo-35920: Windows 10 ARM32 platform support (GH-11774) 2019-04-25 18:36:45 +00:00
Victor Stinner 8c3ecc6bac
bpo-21536: C extensions are no longer linked to libpython (GH-12946)
On Unix, C extensions are no longer linked to libpython.

It is now possible to load a C extension built using a shared library
Python with a statically linked Python.

When Python is embedded, libpython must not be loaded with
RTLD_LOCAL, but RTLD_GLOBAL instead. Previously, using RTLD_LOCAL, it
was already not possible to load C extensions which were not linked
to libpython, like C extensions of the standard library built by the
"*shared*" section of Modules/Setup.

distutils, python-config and python-config.py have been modified.
2019-04-25 20:13:10 +02:00
Victor Stinner d7befad328
bpo-35537: Document posix_spawn() change in subprocess (GH-11668)
Document that subprocess.Popen no longer raise an exception on error
like missing program on very specific platforms when using
os.posix_spawn() is used.
2019-04-25 14:30:16 +02:00