- 04 Sep, 2019 4 commits
-
-
Steve Dower authored
-
Zackery Spytz authored
-
Roger Iyengar authored
Automerge-Triggered-By: @ned-deily
-
Greg Price authored
The purpose of the `unicodedata.is_normalized` function is to answer the question `str == unicodedata.normalized(form, str)` more efficiently than writing just that, by using the "quick check" optimization described in the Unicode standard in UAX #15. However, it turns out the code doesn't implement the full algorithm from the standard, and as a result we often miss the optimization and end up having to compute the whole normalized string after all. Implement the standard's algorithm. This greatly speeds up `unicodedata.is_normalized` in many cases where our partial variant of quick-check had been returning MAYBE and the standard algorithm returns NO. At a quick test on my desktop, the existing code takes about 4.4 ms/MB (so 4.4 ns per byte) when the partial quick-check returns MAYBE and it has to do the slow normalize-and-compare: $ build.base/python -m timeit -s 'import unicodedata; s = "\uf900"*500000' \ -- 'unicodedata.is_normalized("NFD", s)' 50 loops, best of 5: 4.39 msec per loop With this patch, it gets the answer instantly (58 ns) on the same 1 MB string: $ build.dev/python -m timeit -s 'import unicodedata; s = "\uf900"*500000' \ -- 'unicodedata.is_normalized("NFD", s)' 5000000 loops, best of 5: 58.2 nsec per loop This restores a small optimization that the original version of this code had for the `unicodedata.normalize` use case. With this, that case is actually faster than in master! $ build.base/python -m timeit -s 'import unicodedata; s = "\u0338"*500000' \ -- 'unicodedata.normalize("NFD", s)' 500 loops, best of 5: 561 usec per loop $ build.dev/python -m timeit -s 'import unicodedata; s = "\u0338"*500000' \ -- 'unicodedata.normalize("NFD", s)' 500 loops, best of 5: 512 usec per loop
-
- 03 Sep, 2019 5 commits
-
-
Tal Einat authored
The HTML5 output from Sphinx 2.x adds '<p>' tags within list elements. Using a new prevtag attribute, ignore these instead of emitting unwanted '\n\n'. Also stop looking for 'first' classes on tags (no longer present) and fix the bug of double-spacing instead of single spacing after <pre> blocks.
-
Steve Dower authored
-
Dong-hee Na authored
-
Tal Einat authored
Extending the hover delay in test_tooltip should avoid spurious test_idle failures. One longer delay instead of two shorter delays results in a net speedup.
-
Alan Yee authored
-`"""` over `'''` -no blank line either before or after the docstring. -place the closing quotes on a line by themselves
-
- 02 Sep, 2019 2 commits
-
-
Anthony Sottile authored
* Fix suspicious.py to actually print the unused rules * Fix the other `self.warn` calls
-
Jason R. Coombs authored
Sync importlib.metadata with importlib_metadata 0.20.
-
- 01 Sep, 2019 5 commits
-
-
Serhiy Storchaka authored
* Use the 'p' format unit instead of manually called PyObject_IsTrue(). * Pass boolean value instead 0/1 integers to functions that needs boolean. * Convert some arguments to boolean only once.
-
Serhiy Storchaka authored
-
Serhiy Storchaka authored
-
Serhiy Storchaka authored
Only AttributeError should be silenced.
-
Serhiy Storchaka authored
Remove methods Element.getchildren(), Element.getiterator() and ElementTree.getiterator() and the xml.etree.cElementTree module.
-
- 31 Aug, 2019 3 commits
-
-
Ashwin Ramaswami authored
Fixes a case in which email._header_value_parser.get_unstructured hangs the system for some invalid headers. This covers the cases in which the header contains either: - a case without trailing whitespace - an invalid encoded word https://bugs.python.org/issue37764 This fix should also be backported to 3.7 and 3.8 https://bugs.python.org/issue37764
-
Daniel Pope authored
-
Inada Naoki authored
-
- 30 Aug, 2019 6 commits
-
-
Inada Naoki authored
MSVC 2015 supports %zd / %zu. "z" is portable enough nowadays.
-
Min ho Kim authored
-
Terry Jan Reedy authored
-
Victor Stinner authored
Fix a ctypes regression of Python 3.8. When a ctypes.Structure is passed by copy to a function, ctypes internals created a temporary object which had the side effect of calling the structure finalizer (__del__) twice. The Python semantics requires a finalizer to be called exactly once. Fix ctypes internals to no longer call the finalizer twice. Create a new internal StructParam_Type which is only used by _ctypes_callproc() to call PyMem_Free(ptr) on Py_DECREF(argument). StructUnionType_paramfunc() creates such object.
-
Sergey Fedoseev authored
-
Raymond Hettinger authored
-
- 29 Aug, 2019 15 commits
-
-
Ned Deily authored
when built on non-Windows system without fd system call support, like older versions of macOS.
-
Thomas A Caswell authored
Fix faulthandler.cancel_dump_traceback_later() call if cancel_dump_traceback_later() was not called previously.
-
Raymond Hettinger authored
-
Rémi Lapeyre authored
-
Paul Ganssle authored
Adds a link to `dateutil.parser.isoparse` in the documentation. It would be nice to set up intersphinx for things like this, but I think we can leave that for a separate PR. CC: @pitrou [bpo-37979](https://bugs.python.org/issue37979) https://bugs.python.org/issue37979 Automerge-Triggered-By: @pitrou
-
Nick Coghlan authored
With `symtable_visit_expr` now correctly adjusting the recursion depth for named expressions, `symtable_handle_namedexpr` should be leaving it alone. Also adds a new check to `PySymtable_BuildObject` that raises `SystemError` if a successful first symbol analysis pass fails to keep the stack depth accounting clean.
-
Joannah Nanjekye authored
Added tests for PyDateTime_xxx_GET_xxx() macros of the C API of the datetime module.
-
Raymond Hettinger authored
-
Raymond Hettinger authored
-
Raymond Hettinger authored
-
Raymond Hettinger authored
-
Justin Blanchard authored
-
Serhiy Storchaka authored
-
Serhiy Storchaka authored
-
Rémi Lapeyre authored
-