- 26 Oct, 2018 4 commits
-
-
Pablo Galindo authored
bpo-34890: Make iscoroutinefunction, isgeneratorfunction and isasyncgenfunction work with functools.partial (GH-9903) inspect.isfunction() processes both inspect.isfunction(func) and inspect.isfunction(partial(func, arg)) correctly but some other functions in the inspect module (iscoroutinefunction, isgeneratorfunction and isasyncgenfunction) lack this functionality. This commits adds a new check in the mentioned functions in the inspect module so they can work correctly with arbitrarily nested partial functions.
-
Stéphane Wirtel authored
-
Serhiy Storchaka authored
-
Victor Stinner authored
_Py_NegativeRefcount() now uses _PyObject_AssertFailed() to dump the object to help debugging.
-
- 25 Oct, 2018 11 commits
-
-
Victor Stinner authored
_PyTraceMalloc_NewReference() is now called by _Py_NewReference(), so move its definition to object.h. Moreover, define it even if Py_LIMITED_API is defined, since _Py_NewReference() is also exposed even if Py_LIMITED_API is defined.
-
Max Bélanger authored
The MagicMock class supports many magic methods, but not __fspath__. To ease testing with modules such as os.path, this function is now supported by default.
-
-
Stéphane Wirtel authored
-
Victor Stinner authored
Changes: * Add _PyObject_AssertFailed() function. * Add _PyObject_ASSERT() and _PyObject_ASSERT_WITH_MSG() macros. * gc_decref(): replace assert() with _PyObject_ASSERT_WITH_MSG() to dump the faulty object if the assertion fails. _PyObject_AssertFailed() calls: * _PyMem_DumpTraceback(): try to log the traceback where the object memory has been allocated if tracemalloc is enabled. * _PyObject_Dump(): log repr(obj). * Py_FatalError(): log the current Python traceback. _PyObject_AssertFailed() uses _PyObject_IsFreed() heuristic to check if the object memory has been freed by a debug hook on Python memory allocators. Initial patch written by David Malcolm. Co-Authored-By: David Malcolm <dmalcolm@redhat.com>
-
Victor Stinner authored
* Add Py_STATIC_INLINE() macro to declare a "static inline" function. If the compiler supports it, try to always inline the function even if no optimization level was specified. * Modify pydtrace.h to use Py_STATIC_INLINE() when WITH_DTRACE is not defined. * Add an unit test on Py_DECREF() to make sure that _Py_NegativeRefcount() reports the correct filename.
-
Tim Graham authored
Regression in b0bf51b32240369ccb736dc32ff82bb96f375402.
-
madman-bob authored
-
Victor Stinner authored
* Modify object.h to ensure that pymem.h is included, to get _Py_tracemalloc_config variable. * Move _PyTraceMalloc_XXX() functions to tracemalloc.h, they need PyObject type. Break circular dependency between pymem.h and object.h.
-
Victor Stinner authored
tracemalloc now tries to update the traceback when an object is reused from a "free list" (optimization for faster object creation, used by the builtin list type for example). Changes: * Add _PyTraceMalloc_NewReference() function which tries to update the Python traceback of a Python object. * _Py_NewReference() now calls _PyTraceMalloc_NewReference(). * Add an unit test.
-
Quentin authored
-
- 24 Oct, 2018 8 commits
-
-
serge-sans-paille authored
.o generated by clang in LTO mode actually are LLVM bitcode files, which leads to a few errors during configure/build step: - add lto flags to the BASECFLAGS instead of CFLAGS, as CFLAGS are used to build autoconf test case, and some are not compatible with clang LTO (they assume binary in the .o, not bitcode) - force llvm-ar instead of ar, as ar is not aware of .o files generated by clang -flto
-
Ned Batchelder authored
-
orlnub123 authored
The spec gets stored on modules with the __spec__ attribute, not spec.
-
TilmanK authored
-
Actually time calculations were remove in commit 891a1f86.
-
Mariatta authored
Replace str.format with f-strings in the code examples of asyncio-task documentation.
-
jdemeyer authored
-
Tal Einat authored
-
- 23 Oct, 2018 11 commits
-
-
Serhiy Storchaka authored
They no longer cache the wchar_t* representation of string objects.
-
Serhiy Storchaka authored
Based on the investigation by Xiang Zhang.
-
Zackery Spytz authored
References could leak, NULL could be dereferenced, and the Expat parser could be double freed when some errors raised.
-
Victor Stinner authored
_PyObject_Dump() now uses an heuristic to check if the object memory has been freed: log "<freed object>" in that case. The heuristic rely on the debug hooks on Python memory allocators which fills the memory with DEADBYTE (0xDB) when memory is deallocated. Use PYTHONMALLOC=debug to always enable these debug hooks.
-
Ned Deily authored
-
Jeremy Kloth authored
-
Zsolt Cserna authored
Fix the documentation of copy2, as it does not copy file ownership (user and group), only mode, mtime, atime and flags. The original text was confusing to developers as it suggested that this command is the same as 'cp -p', but according to cp(1), '-p' copies file ownership as well. Clarify which metadata is copied by shutil.copystat in its docstring.
-
-
Josh Snyder authored
-
Alexey Izbyshev authored
-
Andrei Petre authored
-
- 22 Oct, 2018 3 commits
-
-
Paul Ganssle authored
* Use _PyUnicode_Copy in sanitize_isoformat_str * Use repr in fromisoformat error message This reverses commit 67b74a98b2 per Serhiy Storchaka's suggestion: I suggested to use %R in the error message because including the raw string can be confusing in the case of empty string, or string containing trailing whitespaces, invisible or unprintable characters. We agree that it is better to change both the C and pure Python versions to use repr. * Retain non-sanitized dtstr for error printing This does not create an extra string, it just holds on to a reference to the original input string for purposes of creating the error message. * PEP 7 fixes to from_isoformat * Separate handling of Unicode and other errors In the initial implementation, errors other than encoding errors would both raise an error indicating an invalid format, which would not be true for errors like MemoryError. * Drop needs_decref from _sanitize_isoformat_str Instead _sanitize_isoformat_str returns a new reference, even to the original string.
-
Eric Lippert authored
The assignment of i/2 to nk is redundant because on this code path, nk is already the size of the dictionary, and i is already twice the size of the dictionary. I've replaced the store with an assertion that i/2 is nk.
-
Tal Einat authored
Raise ValueError OverflowError in case of a negative _length_ in a ctypes.Array subclass. Also raise TypeError instead of AttributeError for non-integer _length_. Co-authored-by: Oren Milman <orenmn@gmail.com>
-
- 21 Oct, 2018 3 commits
-
-
Xtreak authored
-
Serhiy Storchaka authored
-