From 61b5ddb27665df1f4324b9e2cd7a4b0af12caf6c Mon Sep 17 00:00:00 2001 From: python-docs-turkish Date: Sat, 24 Feb 2024 17:23:29 +0000 Subject: [PATCH] Get changes from CPython Doc for 3.12 --- c-api/hash.po | 57 +++++++ howto/gdb_helpers.po | 395 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 452 insertions(+) create mode 100644 c-api/hash.po create mode 100644 howto/gdb_helpers.po diff --git a/c-api/hash.po b/c-api/hash.po new file mode 100644 index 000000000..2a2bb75eb --- /dev/null +++ b/c-api/hash.po @@ -0,0 +1,57 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.12\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-02-24 17:22+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: c-api/hash.rst:4 +msgid "PyHash API" +msgstr "" + +#: c-api/hash.rst:6 +msgid "See also the :c:member:`PyTypeObject.tp_hash` member." +msgstr "" + +#: c-api/hash.rst:10 +msgid "Hash value type: signed integer." +msgstr "" + +#: c-api/hash.rst:16 +msgid "Hash value type: unsigned integer." +msgstr "" + +#: c-api/hash.rst:23 +msgid "Hash function definition used by :c:func:`PyHash_GetFuncDef`." +msgstr "" + +#: c-api/hash.rst:31 +msgid "Hash function name (UTF-8 encoded string)." +msgstr "" + +#: c-api/hash.rst:35 +msgid "Internal size of the hash value in bits." +msgstr "" + +#: c-api/hash.rst:39 +msgid "Size of seed input in bits." +msgstr "" + +#: c-api/hash.rst:46 +msgid "Get the hash function definition." +msgstr "" + +#: c-api/hash.rst:49 +msgid ":pep:`456` \"Secure and interchangeable hash algorithm\"." +msgstr "" diff --git a/howto/gdb_helpers.po b/howto/gdb_helpers.po new file mode 100644 index 000000000..5879c9e10 --- /dev/null +++ b/howto/gdb_helpers.po @@ -0,0 +1,395 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.12\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-02-24 17:22+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: howto/gdb_helpers.rst:5 +msgid "Debugging C API extensions and CPython Internals with GDB" +msgstr "" + +#: howto/gdb_helpers.rst:9 +msgid "" +"This document explains how the Python GDB extension, ``python-gdb.py``, can " +"be used with the GDB debugger to debug CPython extensions and the CPython " +"interpreter itself." +msgstr "" + +#: howto/gdb_helpers.rst:13 +msgid "" +"When debugging low-level problems such as crashes or deadlocks, a low-level " +"debugger, such as GDB, is useful to diagnose and correct the issue. By " +"default, GDB (or any of its front-ends) doesn't support high-level " +"information specific to the CPython interpreter." +msgstr "" + +#: howto/gdb_helpers.rst:18 +msgid "" +"The ``python-gdb.py`` extension adds CPython interpreter information to GDB. " +"The extension helps introspect the stack of currently executing Python " +"functions. Given a Python object represented by a :c:expr:`PyObject *` " +"pointer, the extension surfaces the type and value of the object." +msgstr "" + +#: howto/gdb_helpers.rst:23 +msgid "" +"Developers who are working on CPython extensions or tinkering with parts of " +"CPython that are written in C can use this document to learn how to use the " +"``python-gdb.py`` extension with GDB." +msgstr "" + +#: howto/gdb_helpers.rst:29 +msgid "" +"This document assumes that you are familiar with the basics of GDB and the " +"CPython C API. It consolidates guidance from the `devguide `_ and the `Python wiki `_." +msgstr "" + +#: howto/gdb_helpers.rst:36 +msgid "Prerequisites" +msgstr "" + +#: howto/gdb_helpers.rst:38 +msgid "You need to have:" +msgstr "" + +#: howto/gdb_helpers.rst:40 +msgid "" +"GDB 7 or later. (For earlier versions of GDB, see ``Misc/gdbinit`` in the " +"sources of Python 3.11 or earlier.)" +msgstr "" + +#: howto/gdb_helpers.rst:42 +msgid "" +"GDB-compatible debugging information for Python and any extension you are " +"debugging." +msgstr "" + +#: howto/gdb_helpers.rst:44 +msgid "The ``python-gdb.py`` extension." +msgstr "" + +#: howto/gdb_helpers.rst:46 +msgid "" +"The extension is built with Python, but might be distributed separately or " +"not at all. Below, we include tips for a few common systems as examples. " +"Note that even if the instructions match your system, they might be outdated." +msgstr "" + +#: howto/gdb_helpers.rst:52 +msgid "Setup with Python built from source" +msgstr "" + +#: howto/gdb_helpers.rst:54 +msgid "" +"When you build CPython from source, debugging information should be " +"available, and the build should add a ``python-gdb.py`` file to the root " +"directory of your repository." +msgstr "" + +#: howto/gdb_helpers.rst:58 +msgid "" +"To activate support, you must add the directory containing ``python-gdb.py`` " +"to GDB's \"auto-load-safe-path\". If you haven't done this, recent versions " +"of GDB will print out a warning with instructions on how to do this." +msgstr "" + +#: howto/gdb_helpers.rst:65 +msgid "" +"If you do not see instructions for your version of GDB, put this in your " +"configuration file (``~/.gdbinit`` or ``~/.config/gdb/gdbinit``)::" +msgstr "" + +#: howto/gdb_helpers.rst:70 +msgid "You can also add multiple paths, separated by ``:``." +msgstr "" + +#: howto/gdb_helpers.rst:74 +msgid "Setup for Python from a Linux distro" +msgstr "" + +#: howto/gdb_helpers.rst:76 +msgid "" +"Most Linux systems provide debug information for the system Python in a " +"package called ``python-debuginfo``, ``python-dbg`` or similar. For example:" +msgstr "" + +#: howto/gdb_helpers.rst:80 +msgid "Fedora:" +msgstr "" + +#: howto/gdb_helpers.rst:87 +msgid "Ubuntu:" +msgstr "" + +#: howto/gdb_helpers.rst:93 +msgid "" +"On several recent Linux systems, GDB can download debugging symbols " +"automatically using *debuginfod*. However, this will not install the " +"``python-gdb.py`` extension; you generally do need to install the debug info " +"package separately." +msgstr "" + +#: howto/gdb_helpers.rst:100 +msgid "Using the Debug build and Development mode" +msgstr "" + +#: howto/gdb_helpers.rst:102 +msgid "For easier debugging, you might want to:" +msgstr "" + +#: howto/gdb_helpers.rst:104 +msgid "" +"Use a :ref:`debug build ` of Python. (When building from " +"source, use ``configure --with-pydebug``. On Linux distros, install and run " +"a package like ``python-debug`` or ``python-dbg``, if available.)" +msgstr "" + +#: howto/gdb_helpers.rst:107 +msgid "Use the runtime :ref:`development mode ` (``-X dev``)." +msgstr "" + +#: howto/gdb_helpers.rst:109 +msgid "" +"Both enable extra assertions and disable some optimizations. Sometimes this " +"hides the bug you are trying to find, but in most cases they make the " +"process easier." +msgstr "" + +#: howto/gdb_helpers.rst:115 +msgid "Using the ``python-gdb`` extension" +msgstr "" + +#: howto/gdb_helpers.rst:117 +msgid "" +"When the extension is loaded, it provides two main features: pretty printers " +"for Python values, and additional commands." +msgstr "" + +#: howto/gdb_helpers.rst:121 +msgid "Pretty-printers" +msgstr "" + +#: howto/gdb_helpers.rst:123 +msgid "" +"This is what a GDB backtrace looks like (truncated) when this extension is " +"enabled::" +msgstr "" + +#: howto/gdb_helpers.rst:142 +msgid "" +"Notice how the dictionary argument to ``PyDict_GetItemString`` is displayed " +"as its ``repr()``, rather than an opaque ``PyObject *`` pointer." +msgstr "" + +#: howto/gdb_helpers.rst:145 +msgid "" +"The extension works by supplying a custom printing routine for values of " +"type ``PyObject *``. If you need to access lower-level details of an " +"object, then cast the value to a pointer of the appropriate type. For " +"example::" +msgstr "" + +#: howto/gdb_helpers.rst:168 +msgid "" +"Note that the pretty-printers do not actually call ``repr()``. For basic " +"types, they try to match its result closely." +msgstr "" + +#: howto/gdb_helpers.rst:171 +msgid "" +"An area that can be confusing is that the custom printer for some types look " +"a lot like GDB's built-in printer for standard types. For example, the " +"pretty-printer for a Python ``int`` (:c:expr:`PyLongObject *`) gives a " +"representation that is not distinguishable from one of a regular machine-" +"level integer::" +msgstr "" + +#: howto/gdb_helpers.rst:183 +msgid "" +"The internal structure can be revealed with a cast to :c:expr:`PyLongObject " +"*`:" +msgstr "" + +#: howto/gdb_helpers.rst:185 +msgid "" +"(gdb) p *(PyLongObject*)some_python_integer $5 = {ob_base = {ob_base = " +"{ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size = 1}, ob_digit = {42}}" +msgstr "" + +#: howto/gdb_helpers.rst:189 +msgid "" +"A similar confusion can arise with the ``str`` type, where the output looks " +"a lot like gdb's built-in printer for ``char *``::" +msgstr "" + +#: howto/gdb_helpers.rst:195 +msgid "" +"The pretty-printer for ``str`` instances defaults to using single-quotes (as " +"does Python's ``repr`` for strings) whereas the standard printer for ``char " +"*`` values uses double-quotes and contains a hexadecimal address::" +msgstr "" + +#: howto/gdb_helpers.rst:202 +msgid "" +"Again, the implementation details can be revealed with a cast to :c:expr:" +"`PyUnicodeObject *`::" +msgstr "" + +#: howto/gdb_helpers.rst:210 +msgid "``py-list``" +msgstr "" + +#: howto/gdb_helpers.rst:212 +msgid "" +"The extension adds a ``py-list`` command, which lists the Python source code " +"(if any) for the current frame in the selected thread. The current line is " +"marked with a \">\"::" +msgstr "" + +#: howto/gdb_helpers.rst:229 +msgid "" +"Use ``py-list START`` to list at a different line number within the Python " +"source, and ``py-list START,END`` to list a specific range of lines within " +"the Python source." +msgstr "" + +#: howto/gdb_helpers.rst:234 +msgid "``py-up`` and ``py-down``" +msgstr "" + +#: howto/gdb_helpers.rst:236 +msgid "" +"The ``py-up`` and ``py-down`` commands are analogous to GDB's regular ``up`` " +"and ``down`` commands, but try to move at the level of CPython frames, " +"rather than C frames." +msgstr "" + +#: howto/gdb_helpers.rst:240 +msgid "" +"GDB is not always able to read the relevant frame information, depending on " +"the optimization level with which CPython was compiled. Internally, the " +"commands look for C frames that are executing the default frame evaluation " +"function (that is, the core bytecode interpreter loop within CPython) and " +"look up the value of the related ``PyFrameObject *``." +msgstr "" + +#: howto/gdb_helpers.rst:246 +msgid "They emit the frame number (at the C level) within the thread." +msgstr "" + +#: howto/gdb_helpers.rst:320 +msgid "For example::" +msgstr "" + +#: howto/gdb_helpers.rst:261 +msgid "so we're at the top of the Python stack." +msgstr "" + +#: howto/gdb_helpers.rst:263 +msgid "" +"The frame numbers correspond to those displayed by GDB's standard " +"``backtrace`` command. The command skips C frames which are not executing " +"Python code." +msgstr "" + +#: howto/gdb_helpers.rst:267 +msgid "Going back down::" +msgstr "" + +#: howto/gdb_helpers.rst:289 +msgid "and we're at the bottom of the Python stack." +msgstr "" + +#: howto/gdb_helpers.rst:291 +msgid "" +"Note that in Python 3.12 and newer, the same C stack frame can be used for " +"multiple Python stack frames. This means that ``py-up`` and ``py-down`` may " +"move multiple Python frames at once. For example::" +msgstr "" + +#: howto/gdb_helpers.rst:315 +msgid "``py-bt``" +msgstr "" + +#: howto/gdb_helpers.rst:317 +msgid "" +"The ``py-bt`` command attempts to display a Python-level backtrace of the " +"current thread." +msgstr "" + +#: howto/gdb_helpers.rst:336 +msgid "" +"The frame numbers correspond to those displayed by GDB's standard " +"``backtrace`` command." +msgstr "" + +#: howto/gdb_helpers.rst:340 +msgid "``py-print``" +msgstr "" + +#: howto/gdb_helpers.rst:342 +msgid "" +"The ``py-print`` command looks up a Python name and tries to print it. It " +"looks in locals within the current thread, then globals, then finally " +"builtins::" +msgstr "" + +#: howto/gdb_helpers.rst:356 +msgid "" +"If the current C frame corresponds to multiple Python frames, ``py-print`` " +"only considers the first one." +msgstr "" + +#: howto/gdb_helpers.rst:360 +msgid "``py-locals``" +msgstr "" + +#: howto/gdb_helpers.rst:362 +msgid "" +"The ``py-locals`` command looks up all Python locals within the current " +"Python frame in the selected thread, and prints their representations::" +msgstr "" + +#: howto/gdb_helpers.rst:370 +msgid "" +"If the current C frame corresponds to multiple Python frames, locals from " +"all of them will be shown::" +msgstr "" + +#: howto/gdb_helpers.rst:390 +msgid "Use with GDB commands" +msgstr "" + +#: howto/gdb_helpers.rst:392 +msgid "" +"The extension commands complement GDB's built-in commands. For example, you " +"can use a frame numbers shown by ``py-bt`` with the ``frame`` command to go " +"a specific frame within the selected thread, like this::" +msgstr "" + +#: howto/gdb_helpers.rst:411 +msgid "" +"The ``info threads`` command will give you a list of the threads within the " +"process, and you can use the ``thread`` command to select a different one::" +msgstr "" + +#: howto/gdb_helpers.rst:419 +msgid "" +"You can use ``thread apply all COMMAND`` or (``t a a COMMAND`` for short) to " +"run a command on all threads. With ``py-bt``, this lets you see what every " +"thread is doing at the Python level::" +msgstr ""