Commit Graph

81045 Commits

Author SHA1 Message Date
Victor Stinner bb8071a4ca
bpo-30458: Disallow control chars in http URLs (GH-12755) (GH-13154) (GH-13315)
Disallow control chars in http URLs in urllib2.urlopen.  This
addresses a potential security problem for applications that do not
sanity check their URLs where http request headers could be injected.

Disable https related urllib tests on a build without ssl (GH-13032)
These tests require an SSL enabled build. Skip these tests when
python is built without SSL to fix test failures.

Use httplib.InvalidURL instead of ValueError as the new error case's
exception. (GH-13044)

Backport Co-Authored-By: Miro Hrončok <miro@hroncok.cz>

(cherry picked from commit 7e200e0763)

Notes on backport to Python 2.7:

* test_urllib tests urllib.urlopen() which quotes the URL and so is
  not vulerable to HTTP Header Injection.
* Add tests to test_urllib2 on urllib2.urlopen().
* Reject non-ASCII characters: range 0x80-0xff.
2019-05-21 15:12:33 +02:00
Terry Jan Reedy c841a30879
[2.7] Update idlelib NEWS.txt for 2.7 (GH-13436) 2019-05-19 22:35:21 -04:00
Miss Islington (bot) eda691dd9d
closes bpo-36951: Correct some types in the type_members struct in typeobject.c. (GH-13403)
(cherry picked from commit 53d378c812)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-05-19 17:49:50 -07:00
Benjamin Peterson 951af2d7f1
closes bpo-36755: Suppress noisy error output in test HTTPS server by default. (GH-13370)
TLS 1.3 has a more efficient handshake protocol. The client can reject the server's credentials and close the connection before the server has even finished writing out all of its initial data. Depending on whether the server finishes writing the rest of its handshake before the it sees the connection is reset, the server will read an empty line or see a ECONNRESET OSError. Nothing is really wrong here with the server or client, so just suppress the error output in the OSError case to fix the test.

This fix isn't required in Python 3 because clients that reject the server's certificate will shut down the TLS layer before closing the TCP connection.
2019-05-17 11:29:38 -07:00
Victor Stinner f24a9f3bf4
bpo-27987: pymalloc: align by 16bytes on 64bit platform (GH-12850) (GH-13319)
(cherry picked from commit f0be4bbb9b)
2019-05-15 16:31:10 +02:00
Terry Jan Reedy 353f8d2282
[2.7] bpo-36807: When saving a file in IDLE, call flush and fsync (GH-13102) (GH-13293) 2019-05-13 18:29:15 -04:00
Gregory P. Smith 7346a16ed5
[2.7] bpo-35925: Skip SSL tests that fail due to weak external certs or old TLS (GH-13124) (GH-13253)
Modern Linux distros such as Debian Buster have default OpenSSL system
configurations that reject connections to servers with weak certificates
by default. This causes our test suite run with external networking
resources enabled to skip these tests when they encounter such a
failure.

Fixing the network servers is a separate issue.
(cherry picked from commit 2cc0223)

Changes to test_ssl.py required as 2.7 has legacy protocol tests.

The test_httplib.py change is omitted from this backport as
self-signed.pythontest.net's certificate was updated and the
test_nntplib.py change is not applicable on 2.7.

Authored-by: Gregory P. Smith greg@krypto.org
2019-05-13 13:16:34 -07:00
Toshio Kuratomi 24ff9a44ac [2.7] closes bpo-14353: Fix detection of bind_textdomain_codeset in libintl. (GH-13265)
In Python-2.7, we were only searching for bind_textdomain_codeset in
libc.  We should have also checked for it in libintl.  This change from
Mel Flynn https://bugs.python.org/file24918/python27-configure.in.patch
fixes that.
2019-05-12 13:47:18 -07:00
Gregory P. Smith 7b5dca8345
[2.7] bpo-36816: Update the self-signed.pythontest.net cert (GH-13192) (GH-13199)
* [2.7] bpo-36816: Update the self-signed.pythontest.net cert (GH-13192)

We updated the server, our testsuite must match.

https://bugs.python.org/issue36816

✈️ CLE -> DEN ✈️ #pycon2019 #beyonce
(cherry picked from commit 6bd81734de)

The 2.7 tree also needed a certificate in the capath directory updated.
The filename for that was determined by `openssl x509 -in $cert.pem -subject_hash`.

Authored-by: Gregory P. Smith <greg@krypto.org>
2019-05-08 18:53:15 -06:00
Julien Palard 8ab24b2ebc [2.7] bpo-24712: Doc: Make sidebar sticky using browser support. (GH-13179)
Patch by Mike Taylor.
2019-05-08 09:32:07 -04:00
Zackery Spytz 7c2c01f02a [2.7] bpo-14546: Fix the argument handling in Tools/scripts/lll.py (GH-13026) (GH-13063)
(cherry picked from commit c4e78b116f)
2019-05-02 15:29:21 -04:00
Miss Islington (bot) 74852b9794
Change bisect to bisect_cmd in docstring (GH-13040)
(cherry picked from commit 11e4a941e9)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2019-05-01 20:01:41 -07:00
Steve Dower 98a4dcefbb
bpo-36742: Fixes handling of pre-normalization characters in urlsplit() (GH-13017) 2019-05-01 15:00:27 +00:00
Miss Islington (bot) 3e5c4a7c80
closes bpo-35329: Change 'Package' to 'package' in accordance with PEP8. (GH-13008)
(cherry picked from commit ee0309f3d8)

Co-authored-by: Utkarsh Gupta <guptautkarsh2102@gmail.com>
2019-04-29 19:25:35 -07:00
Victor Stinner be6cbfb767
bpo-35952: Sync test.pythoninfo from master (GH-13010) 2019-04-29 15:20:38 +02:00
Victor Stinner f4edd39017
bpo-28552: Fix distutils.sysconfig for empty sys.executable (GH-12875) (GH-12949)
bpo-28552, bpo-7774: Fix distutils.sysconfig if sys.executable is
None or an empty string: use os.getcwd() to initialize project_base.

Fix also the distutils build command: don't use sys.executable if
it's evaluated as false (None or empty string).
2019-04-25 13:16:02 +02:00
Zackery Spytz 84efbaecaf [2.7] bpo-9194: Fix the bounds checking in winreg.c's fixupMultiSZ() (GH-12687) (GH-12916)
(cherry picked from commit 56ed86490c)



https://bugs.python.org/issue9194
2019-04-22 16:35:55 -07:00
Victor Stinner 44a2c4aaf2
bpo-36605: make tags: parse Modules/_io directory (GH-12789) (GH-12815)
"make tags" and "make TAGS" now also parse Modules/_io/*.c
and Modules/_io/*.h.

(cherry picked from commit 21a74a9d77)
2019-04-13 02:50:24 +02:00
Joshua Root 0fd5a7338c bpo-34652: Use AC_CHECK_FUNCS for lchmod. (GH-12799)
A fix for 69e9691015, which resulted in lchmod being disabled on all platforms, not just Linux.

(cherry picked from commit ed709d5699)
2019-04-12 08:51:35 -07:00
Victor Stinner 22de4ce498
bpo-36235: Fix distutils test_customize_compiler() on macOS (GH-12751)
Set CUSTOMIZED_OSX_COMPILER to True to disable
_osx_support.customize_compiler().
2019-04-09 19:54:10 +02:00
Victor Stinner 9c14061a2c
bpo-36560: Fix reference leak hunting in regrtest (GH-12744) (GH-12745)
Fix reference leak hunting in regrtest: compute also deltas (of
reference count and file descriptor count) during warmup, to ensure
that everything is initialized before starting to hunt reference
leaks.

Other changes:

* Replace gc.collect() with support.gc_collect() in clear_caches()
* dash_R() is now more quiet with --quiet option (don't display
  progress).
* Precompute the full range for "for it in range(repcount):" to
  ensure that the iteration doesn't allocate anything new.
* dash_R() now is responsible to call warm_caches().

(cherry picked from commit 5aaac94eeb)
2019-04-09 18:01:17 +02:00
Inada Naoki 4e8e8aabc6
bpo-30134: fix BytesWarning doc, docstring and message (GH-12739) 2019-04-09 21:49:49 +09:00
Inada Naoki 87ed1beb3e
bpo-30134: add BytesWarning in warnings.rst (GH-12738) 2019-04-09 16:00:51 +09:00
cocoatomo d012d64b6a bpo-30134: add an explanation of BytesWarning (GH-1249) 2019-04-09 14:43:11 +09:00
Zackery Spytz fd83a823a6 bpo-36504: Fix signed integer overflow in _ctypes.c's PyCArrayType_new(). (GH-12660) (GH-12678)
(cherry picked from commit 487b73ab39)
2019-04-03 21:59:51 +03:00
Zackery Spytz a110817c08 bpo-36150: Fix possible assertion failures due to _ctypes.c's PyCData_reduce(). (GH-12106) (GH-12643)
(cherry picked from commit 5f2c50810a)
2019-03-31 20:14:16 +03:00
Miss Islington (bot) dffe90ee0e
bpo-36459: Fix a possible double PyMem_FREE() due to tokenizer.c's tok_nextc() (12601)
Remove the PyMem_FREE() call added in cb90c89.  The buffer will be
freed when PyTokenizer_Free() is called on the tokenizer state.
(cherry picked from commit cda139d1de)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-03-28 07:44:21 -07:00
Steve Dower bb89aa24cf
bpo-36245: Avoid problems when building in a directory containing spaces. (GH-12241) 2019-03-27 16:28:33 -07:00
Miss Islington (bot) 600aca47f0
bpo-31292: Fixed distutils check --restructuredtext for include directives (GH-10605)
(cherry picked from commit d5a5a33f12)

Co-authored-by: Philipp A <flying-sheep@web.de>
2019-03-27 15:23:19 -07:00
Miss Islington (bot) 6cbb4c0795
bpo-33832: Add "magic method" glossary entry (GH-7630)
(cherry picked from commit f760610bdd)

Co-authored-by: Andre Delfino <adelfino@gmail.com>
2019-03-26 18:26:14 -07:00
Miss Islington (bot) 5a3316931c
[2.7] bpo-34203: FAQ: improve wording of paragraph about 2.x vs. 3.x (GH-9821) (GH-12568)
(cherry picked from commit 6cd658b1a5)


Co-authored-by: Tal Einat <taleinat+github@gmail.com>


https://bugs.python.org/issue34203
2019-03-26 14:17:16 -07:00
Miss Islington (bot) c0dce6aa2c bpo-36430: Fix a possible reference leak in itertools.count(). (GH-12551) (GH-12554)
(cherry picked from commit 0523c39e77)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-03-26 00:55:35 -07:00
Miss Islington (bot) bd96393cda
bpo-34085: Improve wording on classmethod/staticmethod (GH-8228)
* bpo-34085: Improve wording on classmethod/staticmethod

* Address comments from Éric

* Address comments from Éric
(cherry picked from commit 548cb6060a)

Co-authored-by: Andre Delfino <adelfino@gmail.com>
2019-03-25 15:58:40 -07:00
Zackery Spytz 0516f81828 [2.7] bpo-36421: Fix ref counting bugs in _ctypes.c's PyCArrayType_new(). (GH-12534)
Add missing Py_DECREF()s.
2019-03-25 16:15:36 +02:00
Victor Stinner 469b0a50d9
bpo-36367: Free buffer if realloc fails in tokenize.c (GH-12442) (GH-12470)
(cherry picked from commit cb90c89de1)
2019-03-20 13:03:41 +01:00
Julien Palard 07b8018d75
[2.7] bpo-35564: add master_doc='contents' to conf.py (GH-12462)
(cherry picked from commit fc8284e220)

Co-authored-by: Jean-François B <jfbu@free.fr>
2019-03-20 10:40:59 +01:00
stratakis d9c6564f90 [2.7] bpo-18368: Fix memory leaks in PyOS_StdioReadline() when realloc() fails (GH-12334)
(cherry picked from commit 9ae513caa7)
2019-03-19 11:43:20 +01:00
Inada Naoki 0f68d4af3b
bpo-36307: Travis: upgrade to Xenial environment (GH-12356)
(cherry picked from commit 74ae50e53e)

Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
2019-03-19 18:08:36 +09:00
Stéphane Wirtel f70b884ad7 bpo-36337: socket.send()/sendall() use Py_ssize_t (GH-12397)
Fix buffer overflow in send() and sendall() methods of socket.socket
for data larger than 2 GiB.
2019-03-19 02:56:28 +01:00
Julien Palard 869652b426
[2.7] bpo-35605: Fix documentation build for sphinx<1.6 (GH-12413)
(cherry picked from commit dfc8fc15fa989acba3c372572e52bbcb5ab38a37)
2019-03-18 19:11:30 +01:00
Victor Stinner 8c380e99e9
bpo-36235: Enhance distutils test_customize_compiler() (GH-12403) (GH-12417)
The test test_customize_compiler() now mocks all sysconfig variables
and all environment variables used by customize_compiler().

(cherry picked from commit 72c7b372cf)
2019-03-18 18:34:06 +01:00
Victor Stinner 37f6971777
bpo-36235: Fix CFLAGS in distutils customize_compiler() (GH-12236) (GH-12349)
Fix CFLAGS in customize_compiler() of distutils.sysconfig: when the
CFLAGS environment variable is defined, don't override CFLAGS variable with
the OPT variable anymore.

Initial patch written by David Malcolm.

Co-Authored-By: David Malcolm <dmalcolm@redhat.com>
(cherry picked from commit 86082c22d2)
2019-03-15 16:03:44 +01:00
Victor Stinner b14057877f
bpo-36262: Fix _Py_dg_strtod() memory leak (goto undfl) (GH-12276) (GH-12332)
Fix an unlikely memory leak on conversion from string to float in the
function _Py_dg_strtod() used by float(str), complex(str),
pickle.load(), marshal.load(), etc.

Fix an unlikely memory leak in _Py_dg_strtod() on "undfl:" label:
rewrite memory management in this function to always release all
memory before exiting the function. Initialize variables to NULL, and
set them to NULL after calling Bfree() at the "cont:" label.

Note: Bfree(NULL) is well defined: it does nothing.

(cherry picked from commit 9776b0636a)
2019-03-14 17:19:52 +01:00
stratakis 2dd6e079ae [2.7] bpo-36289: Fix a possible reference leak in the io module (GH-12329)
Fix a reference leak in _bufferedreader_read_all():
_io.BufferedIOMixin.read() leaks a reference on 'data'
when it reads the whole file content but flush() fails.
2019-03-14 16:35:40 +01:00
stratakis fb3336acfd [2.7] bpo-36291: Fix a possible reference leak in the json module (GH-12330)
Fix a reference leak in json if parsing a floating point number fails.

If PyOS_string_to_double() fails in _match_number_str():
decrement numstr ref counter.
2019-03-14 16:22:46 +01:00
stratakis 2832ad5335 [2.7] bpo-36212: Fix two possible reference leaks in the hotshot module (GH-12327)
Fix reference leaks in _hotshot.LogReaderType on PyTuple_New() failure.
2019-03-14 16:10:58 +01:00
Steve Dower ce5c7a93d4
bpo-36174: Update nuget authoring for new license field. (GH-12300) 2019-03-13 14:43:47 -07:00
Steve Dower 507bd8cde6
[3.7] bpo-36216: Only print test messages when verbose (GH-12291) 2019-03-12 13:51:58 -07:00
Victor Stinner 701af605df
bpo-36234: test_os: check TypeError for invalid uid type (GH-12235)
Patch written by David Malcolm.

Co-Authored-By: David Malcolm <dmalcolm@redhat.com>
2019-03-11 13:59:43 +01:00
Miss Islington (bot) 55438d7139
bpo-35807: Upgrade ensurepip bundled pip and setuptools (GH-12189)
* Update pip to 19.0.3
* Update setuptools to 40.8.0
(cherry picked from commit 01e0f439f5)

Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
2019-03-08 13:45:01 -08:00