Commit Graph

43796 Commits

Author SHA1 Message Date
Serhiy Storchaka 830ddc74c4
Revert "bpo-35603: Escape table header of make_table output that can cause potential XSS. (GH-11341)" (GH-11356)
This reverts commit 78de01198b.
2019-01-02 14:49:25 +02:00
Stefan Behnel 3a374e0c5a bpo-35588: Speed up mod, divmod and floordiv operations for Fraction type (#11322)
* bpo-35588: Implement mod and divmod operations for Fraction type by spelling out the numerator/denominator calculation, instead of instantiating and normalising Fractions along the way. This speeds up '%' and divmod() by 2-3x.

* bpo-35588: Also reimplement Fraction.__floordiv__() using integer operations to make it ~4x faster.

* Improve code formatting.

Co-Authored-By: scoder <stefan_ml@behnel.de>

* bpo-35588: Fix return type of divmod(): the result of the integer division should be an integer.

* bpo-35588: Further specialise __mod__() and inline the original helper function _flat_divmod() since it's no longer reused.

* bpo-35588: Add some tests with large numerators and/or denominators.

* bpo-35588: Use builtin "divmod()" function for implementing __divmod__() in order to simplify the implementation, even though performance results are mixed.

* Rremove accidentally added empty line.

* bpo-35588: Try to provide more informative output on test failures.

* bpo-35588: Improve wording in News entry.

Co-Authored-By: scoder <stefan_ml@behnel.de>

* Remove stray space.
2019-01-02 14:22:06 +02:00
Cheryl Sabella b4ea8bb080 bpo-35598: IDLE - Globalize some config_key objects (GH-11392)
Move translate_key() and constant tuples to module level.
Inline the remnant one-line function.
2018-12-31 15:06:35 -05:00
Serhiy Storchaka 052b2dfdc9
bpo-32492: Tweak _collections._tuplegetter. (GH-11367)
* Replace the docstrings cache with sys.intern().
* Improve tests.
* Unify names of tp_descr_get and tp_descr_set functions.
2018-12-31 14:15:16 +02:00
Serhiy Storchaka 5c117dd227
bpo-35609: Remove examples for deprecated decorators in the abc module. (GH-11355) 2018-12-31 09:56:21 +02:00
sth 7108aab49c Fix typo in test module usage message (GH-11374)
A minor typo in the output of `python -m test -h`.
A space was missing in between two words.
howmuch -> how much
2018-12-30 21:41:39 -08:00
Sanyam Khurana b539cef31c bpo-35614: Fix pydoc help() on metaclasses (#11357) 2018-12-31 15:14:47 +10:00
Gregory P. Smith e5796c42c6
bpo-35214: Skip test_io tests that'd cause a huge malloc under msan (#11385)
* skip test_constructor under msan.

* fix the others as well.

* reuse existing related news entry.

* typo fix
2018-12-30 20:17:57 -08:00
Gregory P. Smith d6f45b23a5
Fix typos in test_faulthandler skipIfs for ubsan. (GH-11386) 2018-12-30 20:15:41 -08:00
Gregory P. Smith 30e023256a
Cleanup test_faulthandler sanitizer skip logic. (GH-11381)
Also skip the same tests when using the undefined behavior sanitizer
as they much with the output.

Updates a regex in another test to use multi-line mode so that the ubsan
buildbot should pass again rather than also adding a skip to that one.
2018-12-30 18:09:26 -08:00
Gregory P. Smith b474e6774d
bpo-35214: MSan workarounds for socket, time, and test_faulthandler. (GH-11375)
Add Clang Memory Sanitizer build instrumentation to work around
false positives from the socket and time modules as well as skipping
a couple test_faulthandler tests.
2018-12-30 17:05:36 -08:00
Cheryl Sabella 4bd79c38ef bpo-35598: IDLE: Switch config_key dialog to ttk widgets (GH-11365) 2018-12-30 14:48:51 -05:00
Pablo Galindo 3f5fc70c62 bpo-32492: 1.6x speed up in namedtuple attribute access using C fast-path (#10495)
* bpo-32492: 2.5x speed up in namedtuple attribute access using C fast path

* Add News entry

* fixup! bpo-32492: 2.5x speed up in namedtuple attribute access using C fast path

* Check for tuple in the __get__ of the new descriptor and don't cache the descriptor itself

* Don't inherit from property. Implement GC methods to handle __doc__

* Add a test for the docstring substitution in descriptors

* Update NEWS entry to reflect time against 3.7 branch

* Simplify implementation with argument clinic, better error messages, only __new__

* Use positional-only parameters for the __new__

* Use PyTuple_GET_SIZE and PyTuple_GET_ITEM to tighter the implementation of tuplegetterdescr_get

* Implement __set__ to make tuplegetter a data descriptor

* Use Py_INCREF now that we inline PyTuple_GetItem

* Apply the valid_index() function, saving one test

* Move Py_None test out of the critical path.
2018-12-30 01:24:03 -08:00
Cheryl Sabella b0a6196ffd bpo-35598: IDLE: Increase test coverage for config_key.py (#11360) 2018-12-29 23:25:09 -05:00
Pablo Galindo d51324a2f5
bpo-35602: Make sure the transport is always closed in SelectorEventLoopUnixSockSendfileTests (GH-11338)
There is a race condition in SelectorEventLoopUnixSockSendfileTests that causes the prepare() method return a non connected server protocol, making the cleanup() method skips the correct handling of the transport. This commit makes prepare() always return a connected server protocol that can always be cleaned up correctly.
2018-12-29 19:18:38 +00:00
Xtreak 78de01198b bpo-35603: Escape table header of make_table output that can cause potential XSS. (GH-11341) 2018-12-29 10:53:14 +02:00
Pablo Galindo 1f511e1af0
Make sure file object is close if socket.create_connection fails (GH-11334)
The problem affects _testWithTimeoutTriggeredSend in test_socket.py.
2018-12-29 01:42:16 +00:00
Pablo Galindo 5471420faa
bpo-35601: Alleviate race condition when waiting for SIGALRM in test_asyncio (GH-11337)
There is a race condition regarding signal delivery in test_signal_handling_args for
test_asyncio.test_events.KqueueEventLoopTests. The signal can be received at any moment outside the time window provided in the test. The fix is to wait for the signal to be received instead with a bigger timeout.
2018-12-29 01:40:21 +00:00
Terry Jan Reedy 4bc246786f
bpo-34055: Revert deletion of line in IDLE's PyShell (#11346)
The attribute is still used in other modules.
2018-12-28 20:06:16 -05:00
Cheryl Sabella c0381aaea4 bpo-28097: IDLE - Add Previous/Next History to Shell menu (#11325) 2018-12-28 15:11:30 -05:00
Cheryl Sabella 804a5d94b6 IDLE: Create function to update menu item state. (GH-11343)
This will be needed for other menu items.  Change outwin to call the function instead of updating the menu item directly.
2018-12-28 13:15:30 -05:00
jab 9e00d9e88f bpo-20849: add dirs_exist_ok arg to shutil.copytree (patch by Josh Bronson) 2018-12-28 19:03:40 +01:00
Michael Felt ed57e13df6 bpo-11191: skip unsupported test_distutils case for AIX with xlc (GH-8709)
Command line options for the xlc compiler behave differently from gcc and clang,
so skip this test case for now when xlc is the compiler.

Patch by aixtools (Michael Felt)
2018-12-29 00:03:17 +10:00
Michael Felt e2926b7248 bpo-34373: fix test_mktime and test_pthread_getcpuclickid tests on AIX (GH-8726)
* Fix test_mktime on AIX by adding code to get mktime to behave the
  same way as it does on other *nix systems
* Fix test_pthread_getcpuclickid in AIX by adjusting the test case
  expectations when running on AIX in 32-bit mode

Patch by Michael Felt.
2018-12-28 23:57:37 +10:00
Terry Jan Reedy c465682718
bpo-35591: IDLE Find Selection now works when selection not found (GH-11339) 2018-12-28 02:41:35 -05:00
Cheryl Sabella 55698cc395 bpo-35598: IDLE: Update config_key.py with PEP8 names (GH-11330)
A few other changes make the code easier to follow.
2018-12-27 22:47:54 -05:00
Andrew Svetlov 34ae04f74d Speed-up building enums by value, e.g. http.HTTPStatus(200) (#11318)
bpo-35585: Speed up enum by-value lookup
2018-12-26 10:45:33 -08:00
Michael Felt 259c159fc1 bpo-34897: avoid distutils test error when CXX is not set (GH-9706)
Depending on system config, a missing candidate compiler name may be
reported as the empty string rather than as None, so adjust the test
helper accordingly.
2018-12-26 15:45:19 +10:00
Michael Felt 2062a20641 bpo-34711: Return HTTPStatus.NOT_FOUND if path.endswith('/') and not a directory (GH-9687)
AIX allows a trailing slash on local file system paths, which isn't what we want
in http.server. Accordingly, check explicitly for this case in the server code,
rather than relying on the OS raising an exception.

Patch by Michael Felt.
2018-12-26 15:43:42 +10:00
Michael Felt 22462da70c bpo-27643 - skip test_ctypes test case with XLC compiler. (GH-5164)
This test case needs "signed short" bitfields, but the
IBM XLC compiler (on AIX) does not support this.

Skip the code and test when AIX and XLC are used.

Use __xlc__ as identifier to detect the XLC compiler.
2018-12-26 13:54:22 +10:00
Michael Felt 5661459f5f bpo-11192: Skip unsupported cases in test_socket on AIX (GH-8954)
* use platform.system() as runtime test, rather than sys.platform() build-time test
* IPv6 zone id support on AIX is limited to inet_pton6_zone(), so skip related
  getaddrinfo() and getnameinfo() tests as not supported
2018-12-26 13:34:37 +10:00
Raymond Hettinger b6af23ebf9
Revert "bpo-35565: Add detail to assertion failure message in wsgiref" (GH-11317)
* Revert part of "bpo-35565:  Remove incorrect test and one that wasn't needed for the fix.
2018-12-25 15:59:07 -08:00
Cheryl Sabella 5ef4fc241a bpo-35565: Add detail to assertion failure message in wsgiref (GH-11293) 2018-12-25 15:19:11 -08:00
Serhiy Storchaka 32d96a2b5b
bpo-23867: Argument Clinic: inline parsing code for a single positional parameter. (GH-9689) 2018-12-25 13:23:47 +02:00
Serhiy Storchaka 65ce60aef1
bpo-20180: Simplify char_converter in Argument Clinic. (GH-9828)
Fix also handling non-ascii default values.
2018-12-25 11:10:05 +02:00
Serhiy Storchaka 837c7dc1ed
bpo-35578: Add an example file for testing Argument Clinic converters. (GH-11306) 2018-12-25 10:17:28 +02:00
Tal Einat 44a79cc5b3
bpo-35208: Fix IDLE Squeezer line counting (GH-10449) 2018-12-24 14:05:51 +02:00
leodema 63d152232e bpo-30561: Sync-up expovariate() and gammavariate code (GH-1934) 2018-12-23 22:54:25 -08:00
Cheryl Sabella 8874f511e7 bpo-35555: IDLE: Gray out Code Context menu item on non-editors (#11282)
The Code Context menu item only works on Editor windows so disable it for others.
2018-12-23 16:26:53 -05:00
Cheryl Sabella 6815155384 bpo-35567: Convert dict of constants to a set (GH-11296) 2018-12-23 08:25:43 -08:00
Recursing 3ce3dea606 Use generator instead of list in code examples (GH-11203)
There is no need to create a list for `sum`
Also, becomes consistent with the first example in Doc/library/os.rst
2018-12-22 19:48:14 -08:00
Serhiy Storchaka 8ac658114d
bpo-30455: Generate all token related code and docs from Grammar/Tokens. (GH-10370)
"Include/token.h", "Lib/token.py" (containing now some data moved from
"Lib/tokenize.py") and new files "Parser/token.c" (containing the code
moved from "Parser/tokenizer.c") and "Doc/library/token-list.inc" (included
in "Doc/library/token.rst") are now generated from "Grammar/Tokens" by
"Tools/scripts/generate_token.py". The script overwrites files only if
needed and can be used on the read-only sources tree.

"Lib/symbol.py" is now generated by "Tools/scripts/generate_symbol_py.py"
instead of been executable itself.

Added new make targets "regen-token" and "regen-symbol" which are now
dependencies of "regen-all".

The documentation contains now strings for operators and punctuation tokens.
2018-12-22 11:18:40 +02:00
Cheryl Sabella c1b4b0f616 bpo-22703: IDLE: Improve Code Context and Zoom Height menu labels (GH-11214)
The Code Context menu label now toggles between Show/Hide Code Context. 
 The Zoom Height menu now toggles between Zoom/Restore Height. 
 Zoom Height has moved from the Window menu to the Options menu. 

 
https://bugs.python.org/issue22703
2018-12-21 22:25:45 -08:00
Christopher Hunt 6ded8986e0 Fix typo in socketserver docstring (GH-11252)
Fix typo in the docstring of `service_actions`.
serve_forver -> serve_forever
2018-12-21 14:22:09 -08:00
Xtreak 6326278e8a bpo-34193: Fix pluralization in getargs.c and test cases. (GH-8438) 2018-12-21 16:45:13 +02:00
Victor Stinner 9a8d1d7562
bpo-35424: emit ResourceWarning at multiprocessing.Pool destruction (GH-10974)
multiprocessing.Pool destructor now emits ResourceWarning
if the pool is still running.
2018-12-20 20:33:51 +01:00
Serhiy Storchaka c5d5dfdb22
bpo-22831: Use "with" to avoid possible fd leaks in distutils. (GH-10921) 2018-12-20 19:00:14 +02:00
Xtreak 71f82a2f20 Fix mock_open docstring to use readline (#11176) 2018-12-20 16:00:21 +00:00
Terry Jan Reedy 292cd6e331
bpo-35521: Add more cross-refs to IDLE docs (#11257)
Format menu and preferences.
2018-12-20 06:06:29 -05:00
Serhiy Storchaka b13a20f507
bpo-5438: Update memory requirements and optimize test_bigmem.py. (GH-11123) 2018-12-20 09:34:51 +02:00