From: Martin Panter Date: Fri, 13 Nov 2015 23:48:17 +0000 (+0000) Subject: Issue #25590: Merge rlcompleter getattr change from 3.5 X-Git-Tag: v3.6.0a1~1066 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f4ad5f5dea172d91ed21d2a330a72e77013bb279;p=python Issue #25590: Merge rlcompleter getattr change from 3.5 --- f4ad5f5dea172d91ed21d2a330a72e77013bb279 diff --cc Lib/rlcompleter.py index 613848f7ad,be8aee0f7e..d368876b0c --- a/Lib/rlcompleter.py +++ b/Lib/rlcompleter.py @@@ -150,26 -144,14 +150,28 @@@ class Completer words.update(get_class_members(thisobject.__class__)) matches = [] n = len(attr) - for word in words: - if word[:n] == attr: - try: - val = getattr(thisobject, word) - except Exception: - continue # Exclude properties that are not set - word = self._callable_postfix(val, "%s.%s" % (expr, word)) - matches.append(word) + if attr == '': + noprefix = '_' + elif attr == '_': + noprefix = '__' + else: + noprefix = None + while True: + for word in words: + if (word[:n] == attr and - not (noprefix and word[:n+1] == noprefix) and - hasattr(thisobject, word)): - val = getattr(thisobject, word) ++ not (noprefix and word[:n+1] == noprefix)): ++ try: ++ val = getattr(thisobject, word) ++ except Exception: ++ continue # Exclude properties that are not set + word = self._callable_postfix(val, "%s.%s" % (expr, word)) + matches.append(word) + if matches or not noprefix: + break + if noprefix == '_': + noprefix = '__' + else: + noprefix = None matches.sort() return matches diff --cc Misc/NEWS index ce8aea1821,2b312e8f40..f95fff06c0 --- a/Misc/NEWS +++ b/Misc/NEWS @@@ -177,241 -145,6 +177,244 @@@ Librar - Issue #24657: Prevent CGIRequestHandler from collapsing slashes in the query part of the URL as if it were a path. Patch from Xiang Zhang. +- Issue #25287: Don't add crypt.METHOD_CRYPT to crypt.methods if it's not + supported. Check if it is supported, it may not be supported on OpenBSD for + example. + +- Issue #23600: Default implementation of tzinfo.fromutc() was returning + wrong results in some cases. + +- Issue #25203: Failed readline.set_completer_delims() no longer left the + module in inconsistent state. + +- Issue #25011: rlcomplete now omits private and special attribute names unless + the prefix starts with underscores. + +- Issue #25209: rlcomplete now can add a space or a colon after completed keyword. + +- Issue #22241: timezone.utc name is now plain 'UTC', not 'UTC-00:00'. + +- Issue #23517: fromtimestamp() and utcfromtimestamp() methods of + datetime.datetime now round microseconds to nearest with ties going to + nearest even integer (ROUND_HALF_EVEN), as round(float), instead of rounding + towards -Infinity (ROUND_FLOOR). + +- Issue #23552: Timeit now warns when there is substantial (4x) variance + between best and worst times. Patch from Serhiy Storchaka. + +- Issue #24633: site-packages/README -> README.txt. + +- Issue #24879: help() and pydoc can now list named tuple fields in the + order they were defined rather than alphabetically. The ordering is + determined by the _fields attribute if present. + +- Issue #24874: Improve speed of itertools.cycle() and make its + pickle more compact. + +- Fix crash in itertools.cycle.__setstate__() when the first argument wasn't + a list. + +- Issue #20059: urllib.parse raises ValueError on all invalid ports. + Patch by Martin Panter. + +- Issue #24360: Improve __repr__ of argparse.Namespace() for invalid + identifiers. Patch by Matthias Bussonnier. + +- Issue #23426: run_setup was broken in distutils. + Patch from Alexander Belopolsky. + +- Issue #13938: 2to3 converts StringTypes to a tuple. Patch from Mark Hammond. + +- Issue #2091: open() accepted a 'U' mode string containing '+', but 'U' can + only be used with 'r'. Patch from Jeff Balogh and John O'Connor. + +- Issue #8585: improved tests for zipimporter2. Patch from Mark Lawrence. + +- Issue #18622: unittest.mock.mock_open().reset_mock would recurse infinitely. + Patch from Nicola Palumbo and Laurent De Buyst. + +- Issue #24426: Fast searching optimization in regular expressions now works + for patterns that starts with capturing groups. Fast searching optimization + now can't be disabled at compile time. + +- Issue #23661: unittest.mock side_effects can now be exceptions again. This + was a regression vs Python 3.4. Patch from Ignacio Rossi + +- Issue #13248: Remove deprecated inspect.getargspec and inspect.getmoduleinfo + functions. + +- Issue #25530: Disable the vulnerable SSLv3 protocol by default when creating + ssl.SSLContext. + +- Issue #25569: Fix memory leak in SSLSocket.getpeercert(). + +- Issue #25471: Sockets returned from accept() shouldn't appear to be + nonblocking. + +- Issue #25319: When threading.Event is reinitialized, the underlying condition + should use a regular lock rather than a recursive lock. + +IDLE +---- + +- Issue #24820: IDLE now has an 'IDLE Dark' built-in text color theme. + It is more or less IDLE Classic inverted, with a cobalt blue background. + Strings, comments, keywords, ... are still green, red, orange, ... . + Selecting it displays the following warning and solution. + "IDLE Dark is new in October, 2015. Trying to run earlier versions + of IDLE with it selected will disable colorizing, or worse. + If you might ever run an earlier release of IDLE, then before + exiting this version, either switch to another theme or hit the + 'Save as New Custom Theme' button. The latter requires a new name, + such as 'Custom Dark', but the custom theme will work with any IDLE + release, and can be modified." + +- Issue #25224: README.txt is now an idlelib index for IDLE developers and + curious users. The previous user content is now in the IDLE doc and is + redundant. IDLE now means 'Integrated Development and Learning Environment'. + +- Issue #24820: Users can now set breakpoint colors in + Settings -> Custom Highlighting. Original patch by Mark Roseman. + +- Issue #24972: Inactive selection background now matches active selection + background, as configured by user, on all systems. Found items are now + always highlighted on Windows. Initial patch by Mark Roseman. + +- Issue #24570: Idle: make calltip and completion boxes appear on Macs + affected by a tk regression. Initial patch by Mark Roseman. + +- Issue #24988: Idle ScrolledList context menus (used in debugger) + now work on Mac Aqua. Patch by Mark Roseman. + +- Issue #24801: Make right-click for context menu work on Mac Aqua. + Patch by Mark Roseman. + +- Issue #25173: Associate tkinter messageboxes with a specific widget. + For Mac OSX, make them a 'sheet'. Patch by Mark Roseman. + +- Issue #25198: Enhance the initial html viewer now used for Idle Help. + * Properly indent fixed-pitch text (patch by Mark Roseman). + * Give code snippet a very Sphinx-like light blueish-gray background. + * Re-use initial width and height set by users for shell and editor. + * When the Table of Contents (TOC) menu is used, put the section header + at the top of the screen. + +- Issue #25225: Condense and rewrite Idle doc section on text colors. + +- Issue #21995: Explain some differences between IDLE and console Python. + +- Issue #22820: Explain need for *print* when running file from Idle editor. + +- Issue #25224: Doc: augment Idle feature list and no-subprocess section. + +- Issue #25219: Update doc for Idle command line options. + Some were missing and notes were not correct. + +- Issue #24861: Most of idlelib is private and subject to change. + Use idleib.idle.* to start Idle. See idlelib.__init__.__doc__. + +- Issue #25199: Idle: add synchronization comments for future maintainers. + +- Issue #16893: Replace help.txt with help.html for Idle doc display. + The new idlelib/help.html is rstripped Doc/build/html/library/idle.html. + It looks better than help.txt and will better document Idle as released. + The tkinter html viewer that works for this file was written by Rose Roseman. + The now unused EditorWindow.HelpDialog class and helt.txt file are deprecated. + +- Issue #24199: Deprecate unused idlelib.idlever with possible removal in 3.6. + +- Issue #24782: In Idle extension config dialog, replace tabs with sorted list. + Patch by Mark Roseman. + +- Issue #24790: Remove extraneous code (which also create 2 & 3 conflicts). + +Documentation +------------- + +- Issue #24952: Clarify the default size argument of stack_size() in + the "threading" and "_thread" modules. Patch from Mattip. + +Tests +----- + +- Issue #25449: Added tests for OrderedDict subclasses. + +- Issue #25188: Add -P/--pgo to test.regrtest to suppress error output when + running the test suite for the purposes of a PGO build. Initial patch by + Alecsandru Patrascu. + +- Issue #22806: Add ``python -m test --list-tests`` command to list tests. + +- Issue #18174: ``python -m test --huntrleaks ...`` now also checks for leak of + file descriptors. Patch written by Richard Oudkerk. + +- Issue #25260: Fix ``python -m test --coverage`` on Windows. Remove the + list of ignored directories. + +- ``PCbuild\rt.bat`` now accepts an unlimited number of arguments to pass along + to regrtest.py. Previously there was a limit of 9. + +Build +----- + +- Issue #24986: It is now possible to build Python on Windows without errors + when external libraries are not available. + +Windows +------- + +- Issue #25022: Removed very outdated PC/example_nt/ directory. + +Tools/Demos +----------- + +- Issue #25440: Fix output of python-config --extension-suffix. + +- Issue #25154: The pyvenv script has been deprecated in favour of + `python3 -m venv`. + + +What's New in Python 3.5.1 release candidate 1? +=============================================== + +Release date: TBA + +Core and Builtins +----------------- + +- Issue #24802: Avoid buffer overreads when int(), float(), compile(), exec() + and eval() are passed bytes-like objects. These objects are not + necessarily terminated by a null byte, but the functions assumed they were. + +- Issue #24402: Fix input() to prompt to the redirected stdout when + sys.stdout.fileno() fails. + +- Issue #25182: The stdprinter (used as sys.stderr before the io module is + imported at startup) now uses the backslashreplace error handler. + +- Issue #25131: Make the line number and column offset of set/dict literals and + comprehensions correspond to the opening brace. + +- Issue #25150: Hide the private _Py_atomic_xxx symbols from the public + Python.h header to fix a compilation error with OpenMP. PyThreadState_GET() + becomes an alias to PyThreadState_Get() to avoid ABI incompatibilies. + +Library +------- + ++- Issue #25590: In the Readline completer, only call getattr() once per ++ attribute. ++ +- Issue #25498: Fix a crash when garbage-collecting ctypes objects created + by wrapping a memoryview. This was a regression made in 3.5a1. Based + on patch by Eryksun. + +- Issue #25232: Fix CGIRequestHandler to split the query from the URL at the + first question mark (?) rather than the last. Patch from Xiang Zhang. + +- Issue #24657: Prevent CGIRequestHandler from collapsing slashes in the + query part of the URL as if it were a path. Patch from Xiang Zhang. + - Issue #24483: C implementation of functools.lru_cache() now calculates key's hash only once.