summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* bpo-13153: Use OS native encoding for converting between Python and Tcl. ↵Serhiy Storchaka2019-10-049-241/+240
| | | | | | | | | | | | | (GH-16545) On Windows use UTF-16 (or UTF-32 for 32-bit Tcl_UniChar) with the "surrogatepass" error handler for converting to/from Tcl Unicode objects. On Linux use UTF-8 with the "surrogateescape" error handler for converting to/from Tcl String objects. Converting strings from Tcl to Python and back now never fails (except MemoryError).
* Updated CODEOWNERS to indicate ownership of some modules. (GH-16578)Vinay Sajip2019-10-041-0/+8
|
* bpo-38235: Correct some arguments names in logging documentation (GH-16571)Ashley Whetter2019-10-041-17/+17
|
* bpo-38353: Rework ismodule() in getpath.c (GH-16574)Victor Stinner2019-10-041-64/+80
| | | | * ismodule() no longer modify the input string. * copy_absolute(), joinpath(): rename parameters and local variables.
* bpo-38353: Add subfunctions to getpath.c (GH-16572)Victor Stinner2019-10-042-157/+265
| | | | | | | | | | | | | | Following symbolic links is now limited to 40 attempts, just to prevent loops. Add subfunctions: * Add resolve_symlinks() * Add calculate_argv0_path_framework() * Add calculate_which() * Add calculate_program_macos() Fix also _Py_wreadlink(): readlink() result type is Py_ssize_t, not int.
* bpo-38353: Fix compiler warning in internal headers (GH-16573)Victor Stinner2019-10-043-16/+16
| | | | Replace "_PyRuntimeState" with "struct pyruntimestate" to avoid a warning on typedef re-definition.
* bpo-38353: Fix compiler warning in pycore_initconfig.h (GH-16570)Victor Stinner2019-10-031-2/+2
| | | | Replace "_PyRuntimeState" with "struct pyruntimestate" to avoid a warning on typedef re-definition.
* bpo-38353: Fix calculate_argv0_path() for symlinks (GH-16549)Victor Stinner2019-10-031-1/+1
| | | | calculate_argv0_path() must read argv0_path link, not read program_full_path link.
* bpo-34344 Fix AbstractEventLoopPolicy.get_event_loop docstring (GH-16463)idomic2019-10-031-2/+2
|
* bpo-38359: Ensures pyw.exe launcher reads correct registry key (GH-16561)Steve Dower2019-10-032-1/+10
|
* bpo-38355: Fix ntpath.realpath failing on sys.executable (GH-16551)Steve Dower2019-10-033-18/+15
|
* bpo-36670: Enhance regrtest (GH-16556)Victor Stinner2019-10-035-56/+97
| | | | | | | | | | | | | | * Add log() method: add timestamp and load average prefixes to main messages. * WindowsLoadTracker: * LOAD_FACTOR_1 is now computed using SAMPLING_INTERVAL * Initialize the load to the arithmetic mean of the first 5 values of the Processor Queue Length value (so over 5 seconds), rather than 0.0. * Handle BrokenPipeError and when typeperf exit. * format_duration(1.5) now returns '1.5 sec', rather than '1 sec 500 ms'
* bpo-36670: Enhance regrtest WindowsLoadTracker (GH-16553)Victor Stinner2019-10-031-26/+42
| | | | The last line is now passed to the parser even if it does not end with a newline, but only if it's a valid value.
* bpo-36670, regrtest: Fix WindowsLoadTracker() for partial line (GH-16550)Victor Stinner2019-10-021-1/+4
| | | | WindowsLoadTracker.read_output() now uses a short buffer for incomplete line.
* bpo-38353: Cleanup includes in the internal C API (GH-16548)Victor Stinner2019-10-0216-31/+27
| | | | Use forward declaration of types to avoid includes in the internal C API. Add also comment to justify other includes.
* bpo-38338, test.pythoninfo: add more ssl infos (GH-16539)Victor Stinner2019-10-021-0/+31
| | | | | test.pythoninfo now logs environment variables used by OpenSSL and Python ssl modules, and logs attributes of 3 SSL contexts (SSLContext, default HTTPS context, stdlib context).
* bpo-36670: regrtest bug fixes (GH-16537)Victor Stinner2019-10-021-10/+12
| | | | | | | | * Fix TestWorkerProcess.__repr__(): start_time is only valid if _popen is not None. * Fix _kill(): don't set _killed to True if _popen is None. * _run_process(): only set _killed to False after calling run_test_in_subprocess().
* bpo-38343: Fixes version handling for nuget packages (GH-16527)Steve Dower2019-10-011-1/+1
|
* bpo-37802: Fix a compiler warning in longobject.c (GH-16517)Victor Stinner2019-10-011-1/+1
| | | | | | | | | bpo-37802, bpo-38321: Fix the following warnings: longobject.c(420): warning C4244: 'function': conversion from 'unsigned __int64' to 'sdigit', possible loss of data longobject.c(428): warning C4267: 'function': conversion from 'size_t' to 'sdigit', possible loss of data
* bpo-37474: Don't call fedisableexcept() on FreeBSD (GH-16515)Victor Stinner2019-10-012-13/+3
| | | | | On FreeBSD, Python no longer calls fedisableexcept() at startup to control the floating point control mode. The call became useless since FreeBSD 6: it became the default mode.
* bpo-38321: Fix compiler warning in _randommodule.c (GH-16512)Victor Stinner2019-10-011-1/+1
| | | | Fix the GCC warning: "initialization discards ‘const’ qualifier from pointer target type".
* bpo-36670: Multiple regrtest bugfixes (GH-16511)Victor Stinner2019-10-013-133/+175
| | | | | | | | | | | | | | | | * Windows: Fix counter name in WindowsLoadTracker. Counter names are localized: use the registry to get the counter name. Original change written by Lorenz Mende. * Regrtest.main() now ensures that the Windows load tracker is also killed if an exception is raised * TestWorkerProcess now ensures that worker processes are no longer running before exiting: kill also worker processes when an exception is raised. * Enhance regrtest messages and warnings: include test name, duration, add a worker identifier, etc. * Rename MultiprocessRunner to TestWorkerProcess * Use print_warning() to display warnings. Co-Authored-By: Lorenz Mende <Lorenz.mende@gmail.com>
* bpo-38304: PyConfig_InitPythonConfig() cannot fail anymore (GH-16509)Victor Stinner2019-10-0112-216/+56
| | | | PyConfig_InitPythonConfig() and PyConfig_InitIsolatedConfig() no longer return PyStatus: they cannot fail anymore.
* bpo-38304: Remove PyConfig.struct_size (GH-16500) (GH-16508)Victor Stinner2019-10-0114-273/+39
| | | | | | | For now, we'll rely on the fact that the config structures aren't covered by the stable ABI. We may revisit this in the future if we further explore the idea of offering a stable embedding API. (cherry picked from commit bdace21b769998396d0ccc8da99a8ca9b507bfdf)
* bpo-38319: Fix shutil._fastcopy_sendfile(): set sendfile() max block size ↵Giampaolo Rodola2019-10-013-5/+11
| | | | (GH-16491)
* bpo-32689: Updates shutil.move to allow for Path objects to be used as ↵Maxwell A McKinnon2019-10-014-2/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | source arg (GH-15326) Important work originally done by @emilyemorehouse two years ago and nearly ready to go in. This bug has affected many people and in some cases has been a dealbreaker to the adoption of the otherwise wonderful pathlib and PEP519. https://stackoverflow.com/questions/33625931/copy-file-with-pathlib-in-python. This adds the outstanding test request from that PR @vstinner (https://github.com/python/cpython/pull/5393). Test fails without the change, passes with it, along with every other test in test_shutil. Some variants were experimented with to make the one line change and the most performant one was picked. # Added Test for PathLike directory destination, the current fail case ``` Lib/test/test_shutil.py::TestMove::test_move_file_pathlike FAILED [100%] ============================================================== FAILURES =============================================================== __________________________________________________ TestMove.test_move_file_pathlike ___________________________________________________ self = <test.test_shutil.TestMove testMethod=test_move_file_pathlike> def test_move_file_pathlike(self): # Move a file to another location on the same filesystem. src = pathlib.Path(self.src_file) > self._check_move_file(src, self.dst_dir, self.dst_file) Lib/test/test_shutil.py:1563: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Lib/test/test_shutil.py:1545: in _check_move_file shutil.move(src, dst) /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/shutil.py:562: in move real_dst = os.path.join(dst, _basename(src)) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path = PosixPath('/var/folders/r2/psq74t5x3nbfzlph8bh2pvdw0000gn/T/tmp9ie0wh9_/foo') def _basename(path): # A basename() variant which first strips the trailing slash, if present. # Thus we always get the last component of the path, even for directories. sep = os.path.sep + (os.path.altsep or '') > return os.path.basename(path.rstrip(sep)) E AttributeError: 'PosixPath' object has no attribute 'rstrip' /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/shutil.py:526: AttributeError ============================================== 1 failed, 102 deselected in 0.30 seconds =============================================== ``` After change: ``` ========================================================= test session starts ========================================================= platform darwin -- Python 3.7.4, pytest-5.0.1, py-1.8.0, pluggy-0.12.0 -- /Users/maxwellmckinnon/.venvs/TA3.7/bin/python3.7 cachedir: .pytest_cache rootdir: /Users/maxwellmckinnon/dev/cpython plugins: cov-2.7.1, mock-1.10.4 collected 103 items / 102 deselected / 1 selected Lib/test/test_shutil.py::TestMove::test_move_file_pathlike PASSED [100%] ============================================== 1 passed, 102 deselected in 0.06 seconds =============================================== ``` Running all the tests in test_shutil.py ``` ╰─ pytest Lib/test/test_shutil.py -v ========================================================= test session starts ========================================================= platform darwin -- Python 3.7.4, pytest-5.0.1, py-1.8.0, pluggy-0.12.0 -- /Users/maxwellmckinnon/.venvs/TA3.7/bin/python3.7 cachedir: .pytest_cache rootdir: /Users/maxwellmckinnon/dev/cpython plugins: cov-2.7.1, mock-1.10.4 collected 103 items Lib/test/test_shutil.py::TestShutil::test_chown PASSED [ 0%] Lib/test/test_shutil.py::TestShutil::test_copy PASSED [ 1%] ... Lib/test/test_shutil.py::TermsizeTests::test_stty_match SKIPPED [ 99%] Lib/test/test_shutil.py::PublicAPITests::test_module_all_attribute PASSED [100%] ================================================ 96 passed, 7 skipped in 1.25 seconds ================================================= ``` # Performance Considerations Is it considered poor form to get rid of _basename altogether and make use of pathlib in the move function? I'm not sure if the idea is for all these modules to strictly avoid circular dependencies. They are already using os.path which is just as much a citizen in 3.8 as pathlib right? e.g. `real_dst = os.path.join(dst, _basename(src))` becomes `real_dst = Path(dst) / Path(src).name` I've looked around and familiarized myself, and I now think importing pathlib here is fine. My only remaining concern is that of performance. Here's the performance difference for this step. ``` In [46]: %timeit real_dst = os.path.join("a/b/c", _basename('b/')) 2.71 µs ± 62.6 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each) In [47]: %timeit real_dst = Path("a/b/c") / Path('b/').name 12.4 µs ± 65.3 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each) ``` Is 10us significant or insignificant compared to the least expensive operation this function will do? I don't know. Let's find out. ``` In [55]: %timeit os.rename('/tmp/a/a.txt', '/tmp/a/b.txt'); os.rename('/tmp/a/b.txt', '/tmp/a/a.txt') 124 µs ± 2.18 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each) ``` 62us to rename. 10us seems significant enough that we wouldn't want to favor the Path sugar suggestion. 16% speed decrease from adding the 10us. What do people think? I was hoping to get to use pathlib.Path here, but I suspect for this low level move, it should be as fast as possible, and 16% is not worth one line of sugary code to me. https://bugs.python.org/issue32689 Automerge-Triggered-By: @gvanrossum
* Fix and improve `asyncio.run()` docs (GH-16403)Kyle Stanley2019-10-013-10/+4
|
* bpo-38321: Fix _testcapimodule.c warning (GH-16494)Victor Stinner2019-09-301-2/+2
| | | | | | | Fix the following warning: modules\_testcapimodule.c(6409): warning C4146: unary minus operator applied to unsigned type, result still unsigned
* Clear weakrefs in garbage found by the GC (#16495)Neil Schemenauer2019-09-302-0/+20
| | | | | Fix a bug due to the interaction of weakrefs and the cyclic garbage collector. We must clear any weakrefs in garbage in order to prevent their callbacks from executing and causing a crash.
* bpo-38321: Fix PyCStructUnionType_update_stgdict() warning (GH-16492)Victor Stinner2019-09-301-1/+1
| | | | | | bpo-22273, bpo-38321: Fix following warning: modules\_ctypes\stgdict.c(704): warning C4244: 'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data
* bpo-38321: Fix _asynciomodule.c compiler warning (GH-16493)Victor Stinner2019-09-301-1/+0
| | | | | | | | | bpo-38248, bpo-38321: Fix warning: modules\_asynciomodule.c(2667): warning C4102: 'set_exception': unreferenced label The related goto has been removed by commit edad4d89e357c92f70c0324b937845d652b20afd.
* bpo-38322: Fix gotlandmark() of PC/getpathp.c (GH-16489)Victor Stinner2019-09-301-8/+6
| | | | | | Write the filename into a temporary buffer instead of reusing prefix. The problem is that join() modifies prefix inplace. If prefix is not normalized, join() can make prefix shorter and so gotlandmark() does modify prefix instead of returning it unmodified.
* bpo-38304: Fix PyConfig usage in python_uwp.cpp (GH-16487)Victor Stinner2019-09-301-1/+7
| | | | | * Set PyPreConfig.struct_size and PyConfig.struct_size as required by the API. * PyPreConfig_InitPythonConfig() can now fail: check PyStatus result.
* bpo-30773: Fix ag_running; prohibit running athrow/asend/aclose in parallel ↵Yury Selivanov2019-09-304-64/+54
| | | | (#7468)
* bpo-38242: Revert "bpo-36889: Merge asyncio streams (GH-13251)" (#16482)Yury Selivanov2019-09-3013-2753/+379
| | | See https://bugs.python.org/issue38242 for more details
* bpo-38163: Child mocks detect their type as sync or async (GH-16471)Lisa Roach2019-09-304-28/+76
|
* bpo-37096: Add large-file tests for modules using sendfile(2) (GH-13676)Giampaolo Rodola2019-09-301-6/+85
|
* bpo-38161: Removes _AwaitEvent from AsyncMock. (GH-16443)Lisa Roach2019-09-303-39/+2
|
* bpo-38317: Fix PyConfig.warnoptions priority (GH-16478)Victor Stinner2019-09-2910-51/+185
| | | | | | | | | Fix warnings options priority: PyConfig.warnoptions has the highest priority, as stated in the PEP 587. * Document options order in PyConfig.warnoptions documentation. * Make PyWideStringList_INIT macro private: replace "Py" prefix with "_Py". * test_embed: add test_init_warnoptions().
* bpo-38019: correctly handle pause/resume reading of closed asyncio unix pipe ↵Andrew Svetlov2019-09-293-0/+39
| | | | (GH-16472)
* bpo-38108: Makes mock objects inherit from Base (GH-16060)Lisa Roach2019-09-294-57/+58
|
* bpo-38310: Predict BUILD_MAP_UNPACK_WITH_CALL -> CALL_FUNCTION_EX. (GH-16467)Brandt Bucher2019-09-292-0/+3
|
* bpo-37408: Precise that Tarfile "format" argument only concerns writing. ↵Pascal Chambon2019-09-281-2/+3
| | | | (GH-14389)
* bpo-38115: Deal with invalid bytecode offsets in lnotab (GH-16079)T. Wouters2019-09-284-2/+77
| | | | | | | | | | Document that lnotab can contain invalid bytecode offsets (because of terrible reasons that are difficult to fix). Make dis.findlinestarts() ignore invalid offsets in lnotab. All other uses of lnotab in CPython (various reimplementations of addr2line or line2addr in Python, C and gdb) already ignore this, because they take an address to look for, instead. Add tests for the result of dis.findlinestarts() on wacky constructs in test_peepholer.py, because it's the easiest place to add them.
* bpo-38216, bpo-36274: Allow subclasses to separately override validation and ↵Jason R. Coombs2019-09-283-9/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | encoding behavior (GH-16448) * bpo-38216: Allow bypassing input validation * bpo-36274: Also allow the URL encoding to be overridden. * bpo-38216, bpo-36274: Add tests demonstrating a hook for overriding validation, test demonstrating override encoding, and a test to capture expectation of the interface for the URL. * Call with skip_host to avoid tripping on the host checking in the URL. * Remove obsolete comment. * Make _prepare_path_encoding its own attr. This makes overriding just that simpler. Also, don't use the := operator to make backporting easier. * Add a news entry. * _prepare_path_encoding -> _encode_prepared_path() * Once again separate the path validation and request encoding, drastically simplifying the behavior. Drop the guarantee that all processing happens in _prepare_path.
* bpo-38304: Add PyConfig.struct_size (GH-16451)Victor Stinner2019-09-2813-60/+350
| | | | | | | | | | | | | | | | | Add a new struct_size field to PyPreConfig and PyConfig structures to allow to modify these structures in the future without breaking the backward compatibility. * Replace private _config_version field with public struct_size field in PyPreConfig and PyConfig. * Public PyPreConfig_InitIsolatedConfig() and PyPreConfig_InitPythonConfig() return type becomes PyStatus, instead of void. * Internal _PyConfig_InitCompatConfig(), _PyPreConfig_InitCompatConfig(), _PyPreConfig_InitFromConfig(), _PyPreConfig_InitFromPreConfig() return type becomes PyStatus, instead of void. * Remove _Py_CONFIG_VERSION * Update the Initialization Configuration documentation.
* bpo-38301: In Solaris family, we must be sure to use '-D_REENTRANT' (#16446)Jesús Cea2019-09-283-0/+8
|
* bpo-38243, xmlrpc.server: Escape the server_title (GH-16373)Dong-hee Na2019-09-273-1/+21
| | | | Escape the server title of xmlrpc.server.DocXMLRPCServer when rendering the document page as HTML.
* Fix typo in the "Porting to Python 3.8" section. (GH-16435)bariod2019-09-271-1/+1
|
* bpo-32820: Simplify __format__ implementation for ipaddress. (GH-16378)Serhiy Storchaka2019-09-271-40/+19
| | | | Also cache the compiled RE for parsing the format specifier.