This is more complicated than it should be because we need to preserve the
useful mtime-based regeneration feature that lib2to3.pgen2.driver.load_grammar
has. We only look for the pickled grammar file with pkgutil.get_data and only if
the source file does not exist..
(cherry picked from commit 8a5877165e)
In fileio, there were 3 fstat() calls and one lseek() call that did not
release the GIL during the call. This can cause all threads to hang for
unlimited time when using io.FileIO with inaccessible NFS server.
Same issue seen in fileio exists also in fileobject, fixed in the same
way.
When PyGILState_Ensure() is called in a non-Python thread before
PyEval_InitThreads(), only call PyEval_InitThreads() after calling
PyThreadState_New() to fix a crash.
(cherry picked from commit b4d1e1f7c1)
The paragraph that contains example of string literal concatenation was placed
after the section about concatenation using the '+' sign.
Moved the paragraph to the appropriate section.
(cherry picked from commit 78a5722ae9)
Move footnote markers to be closer to the related terminology:
before the end of the sentence, instead of after.
(cherry picked from commit cdfe910e74)
_PyObject_DebugReallocApi() now calls Py_FatalError() if realloc()
fails to shrink a memory block.
Call Py_FatalError() because _PyObject_DebugReallocApi() erased freed
bytes *before* realloc(), expecting that realloc() *cannot* fail to
shrink a memory block.
* bpo-31324: Optimize support._match_test() (#4421)
* Rename support._match_test() to support.match_test(): make it
public
* Remove support.match_tests global variable. It is replaced with a
new support.set_match_tests() function, so match_test() doesn't
have to check each time if patterns were modified.
* Rewrite match_test(): use different code paths depending on the
kind of patterns for best performances.
Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit 803ddd8ce2)
* bpo-31324: Fix test.support.set_match_tests(None) (#4505)
(cherry picked from commit bb11c3c967)
(cherry picked from commit 70b2f87971)
Fix the following warning:
Warning -- files was modified by test_builtin
Before: []
After: ['@test_19422_tmp']
1 test altered the execution environment:
test_builtin
* Work around a GC process finalization bug.
The logging RLock instances may exist but the threading.RLock class
itself has already been emptied causing a
Exception TypeError: "'NoneType' object is not callable" in <function _removeHandlerRef ..."
to be printed to stderr on process termination.
This catches that exception and ignores it because there is absolutely
nothing we can or should do about it from the context of a weakref
handler called from the gc context.
Define __hash__() in test_functools and test_itertools to fix the
following warning:
DeprecationWarning: Overriding __eq__ blocks inheritance of __hash__ in 3.x
* Using ifconfig on NetBSD and OpenBSD.
* Using arp on Linux, FreeBSD, NetBSD and OpenBSD.
Based on patch by Takayuki Shimizukawa..
(cherry picked from commit ee1a9a2b78)