Commit Graph

115 Commits

Author SHA1 Message Date
Victor Stinner 2efdd2a14e
gh-106023: Remove _PyObject_FastCall() function (#106265) 2023-06-30 11:46:43 +02:00
Carl Meyer 0dc8b50d33
gh-87729: add LOAD_SUPER_ATTR instruction for faster super() (#103497)
This speeds up `super()` (by around 85%, for a simple one-level
`super().meth()` microbenchmark) by avoiding allocation of a new
single-use `super()` object on each use.
2023-04-24 22:22:14 +00:00
Inada Naoki 7aeb06f78e
Do not run test_gdb when gdb embeds Python 2. (GH-31956) 2022-03-17 18:00:56 +09:00
Victor Stinner bebaa95fd0
bpo-46600: Fix test_gdb.test_pycfunction() for clang -Og (GH-31058)
Fix test_gdb.test_pycfunction() for Python built with clang -Og.
Tolerate inlined functions in the gdb traceback.

When _testcapimodule.c is built by clang -Og, _null_to_none() is
inlined in meth_varargs() and so gdb returns _null_to_none() as
the frame #1. If it's not inlined, meth_varargs() is the frame #1.
2022-02-01 18:12:26 +01:00
Pablo Galindo Salgado f4c03484da
bpo-45637: Remove broken fallback in gdb helpers to obtain frame variable (GH-29257) 2021-11-09 11:19:47 +00:00
Mark Shannon 70945d57e7
bpo-45256: Avoid C calls for most Python to Python calls. (GH-28937)
* Avoid making C calls for most calls to Python functions.

* Change initialize_locals(steal=true) and _PyTuple_FromArraySteal to consume the argument references regardless of whether they succeed or fail.
2021-10-18 09:57:24 +01:00
Pablo Galindo Salgado b4903afd4d
bpo-45256: Remove the usage of the C stack in Python to Python calls (GH-28488)
Ths commit inlines calls to Python functions in the eval loop and steals all the arguments in the call from the caller for
performance.
2021-10-09 16:51:30 +01:00
Victor Stinner 84a6061e29
bpo-45207: Make test_gdb.test_pycfunction() quiet (GH-28355)
test_gdb.test_pycfunction() now ignores gdb stderr, it no longer logs
messages like:

    Function "meth_varargs" not defined.
2021-09-15 20:21:06 +02:00
Mark Shannon cee67fa661
bpo-44821: Eagerly assign __dict__ for new objects. (GH-27589) 2021-08-04 16:41:14 +01:00
Mark Shannon b11a951f16
bpo-44032: Move data stack to thread from FrameObject. (GH-26076)
* Remove 'zombie' frames. We won't need them once we are allocating fixed-size frames.

* Add co_nlocalplus field to code object to avoid recomputing size of locals + frees + cells.

* Move locals, cells and freevars out of frame object into separate memory buffer.

* Use per-threadstate allocated memory chunks for local variables.

* Move globals and builtins from frame object to per-thread stack.

* Move (slow) locals frame object to per-thread stack.

* Move internal frame functions to internal header.
2021-05-21 10:57:35 +01:00
Victor Stinner 066394018a
bpo-41473: Reenable test_gdb on gdb 9.2 and newer (GH-23637)
https://bugzilla.redhat.com/show_bug.cgi?id=1866884 is fixed in gdb
10.1 (failed to reproduce on gdb-10.1-1.fc34.aarch64).
2020-12-04 16:23:56 +01:00
Victor Stinner e27a51c11e
bpo-41473: Skip test_gdb with gdb 9.2 to work around gdb bug (GH-21768)
gdb 9.2 on Fedora Rawhide is not reliable, see:

* https://bugs.python.org/issue41473
* https://bugzilla.redhat.com/show_bug.cgi?id=1866884
2020-08-07 17:57:56 +02:00
Victor Stinner b2dca49ca3
bpo-34401: Fix test_gdb for HP GDB version string (GH-20804)
The GDB provided by HPE on HP-UX contains a modified version string. Therefore
the tests fail. Adapt the regex to match that string.

Patch by Michael Osipov.

Co-Authored-by: Michael Osipov <michael.osipov@siemens.com>
2020-06-11 15:48:03 +02:00
Victor Stinner ec9bea4a37
bpo-40436: Fix code parsing gdb version (GH-19792)
test_gdb and test.pythoninfo now check gdb command exit code.
2020-04-29 17:11:48 +02:00
Victor Stinner 7bf069b611
bpo-40019: Skip test_gdb if Python was optimized (GH-19081)
test_gdb now skips tests if it detects that gdb failed to read debug
information because the Python binary is optimized.
2020-03-20 08:23:26 +01:00
Victor Stinner 64b4a3a2de
bpo-38239: Fix test_gdb for Link Time Optimization (LTO) (GH-16422) 2019-09-26 16:54:13 +02:00
Petr Viktorin f958377b67 bpo-37499: Test various C calling conventions (GH-15776)
Add functions with various calling conventions to `_testcapi`, expose them as module-level functions, bound methods, class methods, and static methods, and test calling them and introspecting them through GDB.


https://bugs.python.org/issue37499


Co-authored-by: Jeroen Demeyer <J.Demeyer@UGent.be>
Automerge-Triggered-By: @pganssle
2019-09-10 04:21:09 -07:00
Victor Stinner 81446fd0d4
test_gdb: use unittest test discovery (GH-15405)
Replace test.support.run_unittest() with unittest.main()
to automatically discover test cases, instead of having
an maintaing manually a list which may be incomplete.

Remove also an unused variable.
2019-08-23 11:28:27 +01:00
Jeroen Demeyer 0d722f3cd6 bpo-36974: separate vectorcall functions for each calling convention (GH-13781) 2019-07-05 14:48:24 +02:00
Victor Stinner e56a123fd0
bpo-37362: test_gdb now ignores stderr (GH-14287)
test_gdb no longer fails if it gets an "unexpected" message on
stderr: it now ignores stderr. The purpose of test_gdb is to test
that python-gdb.py commands work as expected, not to test gdb.
2019-06-21 23:17:30 +02:00
Petr Viktorin 64e2c64f7f
test_gdb.test_pycfunction: test more calling conventions (GH-13668)
As the code paths for various METH_* conventions are diverging due
to optimizations, we should check they continue to be covered by
GDB integration.
2019-06-02 23:11:24 +02:00
Petr Viktorin fecb75c1bb
bpo-36974: Fix GDB integration (GH-13665)
As it changes the way functions are called, the PEP 590 implementation
skipped the functions that the GDB integration is looking for
(by name) to find function calls.

Looking for the new helper `cfunction_call_varargs` hopefully fixes the
tests, and thus buildbots.

The changed frame nuber in test_gdb is due to there being fewer
C calls when calling a built-in method.
2019-05-29 22:45:41 +02:00
Steve Dower 6de4574c63
bpo-37023: Skip test_gdb under PGO (GH-13555) 2019-05-24 13:00:04 -07:00
Srinivas Thatiparthy (శ్రీనివాస్ తాటిపర్తి) 90d0cfb222 bpo-35202: Remove unused imports in tests. (GH-10561) 2018-11-16 17:32:58 +02:00
Lysandros Nikolaou 59668aa8b7 bpo-21263: Skip test_gdb when python has been compiled with LLVM clang (GH-10318) 2018-11-04 16:21:28 -05:00
Victor Stinner 79d21331e6
bpo-32962: Fix test_gdb failure in debug build with -mcet -fcf-protection -O0 (GH-9656)
When Python is built with the intel control-flow protection flags,
-mcet -fcf-protection, gdb is not able to read the stack without
actually jumping inside the function. This means an extra
'next' command is required to make the $pc (program counter)
enter the function and make the stack of the function exposed to gdb.

Co-Authored-By: Marcel Plch <gmarcel.plch@gmail.com>

(cherry picked from commit 9b7c74ca32)
2018-10-09 16:54:04 +02:00
Elvis Pranskevichus 7279b5125e bpo-34537: Fix test_gdb:test_strings with LC_ALL=C (GH-9483)
We cannot simply call locale.getpreferredencoding() here,
as GDB might have been linked against a different version
of Python with a different encoding and coercion policy
with respect to PEP 538 and PEP 540.

Thanks to Victor Stinner for a hint on how to fix this.
2018-09-21 18:13:16 -07:00
Pablo Galindo f2ef51f8be
bpo-34007: Skip traceback tests if the Program Counter is not available. (GH-9018)
Sometimes some versions of the shared libraries that are part of the
traceback are compiled in optimised mode and the Program Counter (PC)
is not present, not allowing gdb to walk the frames back. When this
happens, the Python bindings of gdb raise an exception, making the
test impossible to succeed.
2018-08-31 23:04:47 +01:00
Victor Stinner 2f9cbaa8b2
Revert "bpo-32962: Fix test_gdb failure in debug build with -mcet -fcf-protection -O0 (GH-6754)" (#7723)
This reverts commit 9b7c74ca32.
2018-06-15 22:54:35 +02:00
Marcel Plch 9b7c74ca32 bpo-32962: Fix test_gdb failure in debug build with -mcet -fcf-protection -O0 (#6754)
When Python is built with the intel control-flow protection flags,
-mcet -fcf-protection, gdb is not able to read the stack without
actually jumping inside the function. This means an extra
'next' command is required to make the $pc (program counter)
enter the function and make the stack of the function exposed to gdb.
2018-06-15 17:56:24 +02:00
Antoine Pitrou a6a4dc816d bpo-31370: Remove support for threads-less builds (#3385)
* Remove Setup.config
* Always define WITH_THREAD for compatibility.
2017-09-07 18:56:24 +02:00
INADA Naoki 5566bbb8d5 Issue #29263: LOAD_METHOD support for C methods
Calling builtin method is at most 10% faster.
2017-02-03 07:43:03 +09:00
Victor Stinner 72268ae1c0 Fix test_gdb.test_wrapper_call() on Python 2
Issue #29367. On Python 2, __init__ name is render as u'__init__'.
2017-02-01 18:26:14 +01:00
Victor Stinner f94b68a025 Make test_gdb.test_wrapper_call() make reliable
Issue #29367. Use two break points to prevent breakpoint during Python
initialization.
2017-02-01 17:00:32 +01:00
Victor Stinner 611083331d python-gdb.py supports method-wrapper
Issue #29367: python-gdb.py now supports also method-wrapper (wrapperobject)
objects.
2017-02-01 16:29:54 +01:00
Victor Stinner fa025f112f Update and enhance python-gdb.py
Issue #29259:

* Detect PyCFunction is the current frame, not only in the older frame
* Ignore PyCFunction_Call() since it now calls _PyCFunction_FastCallDict(), and
  _PyCFunction_FastCallDict() is already detected
2017-01-18 17:20:01 +01:00
Victor Stinner e3d75c63cd Issue #28770: Update python-gdb.py for fastcalls
Frame.is_other_python_frame() now also handles _PyCFunction_FastCallDict()
frames.

Thanks to the new code to handle fast calls, python-gdb.py is now also able to
detect the <built-in id method of module ...> frame.
2016-11-22 22:53:18 +01:00
INADA Naoki d7d2bc8798 Issue #28023: Fix python-gdb.py didn't support new dict implementation 2016-11-22 19:40:58 +09:00
R David Murray 44b548dda8 #27364: fix "incorrect" uses of escape character in the stdlib.
And most of the tools.

Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and
Martin Panter.
2016-09-08 13:59:53 -04:00
Victor Stinner 742da040db Implement compact dict
Issue #27350: `dict` implementation is changed like PyPy. It is more compact
and preserves insertion order.

_PyDict_Dummy() function has been removed.

Disable test_gdb: python-gdb.py is not updated yet to the new structure of
compact dictionaries (issue #28023).

Patch written by INADA Naoki.
2016-09-07 17:40:12 -07:00
Benjamin Peterson 437df90537 get skipIf from the right place 2016-09-06 20:22:41 -07:00
Steve Dower 22d0698d3b Adds test.support.PGO and skips tests that are not useful for PGO. 2016-09-06 19:38:15 -07:00
Benjamin Peterson 45c7514de4 merge 3.5 (#27969) 2016-09-06 10:06:51 -07:00
Benjamin Peterson cbef66d711 suppress stderr output when checking gdb (closes #27969) 2016-09-06 10:06:31 -07:00
Raymond Hettinger f74c33ad5c Merge 2016-08-25 21:12:16 -07:00
Raymond Hettinger 7ea386e56e Issue 19504: Change "customise" to "customize" American spelling. 2016-08-25 21:11:50 -07:00
Serhiy Storchaka e437a10d15 Issue #23277: Remove unused imports in tests. 2016-04-24 21:41:02 +03:00
Victor Stinner 0d88c65231 Backport test_gdb fix for s390x buildbots 2016-04-20 00:30:14 +02:00
Victor Stinner c53195bbf0 Try to fix test_gdb on s390x SLES 3.x
Ignore empty lines in stderr.
2016-03-23 21:08:25 +01:00
Victor Stinner 904f5def5c Try to fix test_gdb on s390x buildbots 2016-03-23 18:32:54 +01:00