chunk_id stringlengths 36 36 | source stringclasses 35
values | source_url stringlengths 0 290 | upstream_license stringclasses 1
value | document_id stringlengths 36 36 | chunk_index int64 0 324k | retrieved_at stringclasses 2
values | chunker_version stringclasses 4
values | content_hash stringlengths 15 64 | content stringlengths 50 44.7k | namespace stringclasses 9
values | source_name stringclasses 35
values | raw_text stringlengths 50 44.7k | cleaned_text stringlengths 50 44.7k | tags stringclasses 49
values | collection_name stringclasses 11
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1a6477ef-48c1-432c-9b12-7261f3667b2b | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,375 | supabase-export-v2 | d9c30f22967047ef | 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::
(gdb) info threads
105 Thread 0x7fffefa18710 (LWP 10260) sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86
104 Thread 0x7fffdf5fe710 (LWP 10259) sem_wait () at... | trusted_official_docs | CPython Docs | 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::
(gdb) info threads
105 Thread 0x7fffefa18710 (LWP 10260) sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86
104 Thread 0x7fffdf5fe710 (LWP 10259) sem_wait () at... | 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::
(gdb) info threads
105 Thread 0x7fffefa18710 (LWP 10260) sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86
104 Thread 0x7fffdf5fe710 (LWP 10259) sem_wait () at... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
26d7078e-34d4-4b71-8604-bfe618e37cdd | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,319 | supabase-export-v2 | 87eebc515879d9cc | 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.
Using the ``python-gdb`` extension
================================== | trusted_official_docs | CPython Docs | 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.
Using the ``python-gdb`` extension
================================== | 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.
Using the ``python-gdb`` extension
================================== | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2b985f31-3995-4dbc-ab1d-b0cf4fde1b07 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,328 | supabase-export-v2 | c19860f98c6d60e8 | me_key = '__doc__', me_value = None}, {me_hash = 0, me_key = 0x0, me_value = 0x0}, { me_hash = 6614918939584953775, me_key = '__package__', me_value = None}}}
Note that the pretty-printers do not actually call ``repr()``. For basic types, they try to match its result closely. | trusted_official_docs | CPython Docs | me_key = '__doc__', me_value = None}, {me_hash = 0, me_key = 0x0, me_value = 0x0}, { me_hash = 6614918939584953775, me_key = '__package__', me_value = None}}}
Note that the pretty-printers do not actually call ``repr()``. For basic types, they try to match its result closely. | me_key = '__doc__', me_value = None}, {me_hash = 0, me_key = 0x0, me_value = 0x0}, { me_hash = 6614918939584953775, me_key = '__package__', me_value = None}}}
Note that the pretty-printers do not actually call ``repr()``. For basic types, they try to match its result closely. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3481b290-fb4f-4a30-8bcf-359fb6159a95 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,341 | supabase-export-v2 | 175b1f9aadcc29e2 | ``py-list`` -----------
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 ">":: | trusted_official_docs | CPython Docs | ``py-list`` -----------
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 ">":: | ``py-list`` -----------
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 ">":: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
35a2a995-b396-445f-880d-298a4fbe6e24 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,350 | supabase-export-v2 | b8f67dc5f605933a | py-up #40 Frame 0x948e82c, for file /usr/lib/python2.6/site-packages/ gnome_sudoku/gnome_sudoku.py, line 22, in start_game(main=<module at remote 0xb771b7f4>) main.start_game() (gdb) py-up Unable to find an older python frame
so we're at the top of the Python stack. | trusted_official_docs | CPython Docs | py-up #40 Frame 0x948e82c, for file /usr/lib/python2.6/site-packages/ gnome_sudoku/gnome_sudoku.py, line 22, in start_game(main=<module at remote 0xb771b7f4>) main.start_game() (gdb) py-up Unable to find an older python frame
so we're at the top of the Python stack. | py-up #40 Frame 0x948e82c, for file /usr/lib/python2.6/site-packages/ gnome_sudoku/gnome_sudoku.py, line 22, in start_game(main=<module at remote 0xb771b7f4>) main.start_game() (gdb) py-up Unable to find an older python frame
so we're at the top of the Python stack. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3cd272aa-7635-48d8-9971-128439d95228 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,372 | supabase-export-v2 | 8b70eeba3532a833 | Use with GDB commands =====================
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:: | trusted_official_docs | CPython Docs | Use with GDB commands =====================
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:: | Use with GDB commands =====================
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:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4007b1cc-8f82-4d1f-b74b-604c0685c4c1 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,337 | supabase-export-v2 | a29b67d6cb16590b | 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::
(gdb) p ptr_to_char_star
$7 = 0x6d72c0 "hello world" | trusted_official_docs | CPython Docs | 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::
(gdb) p ptr_to_char_star
$7 = 0x6d72c0 "hello world" | 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::
(gdb) p ptr_to_char_star
$7 = 0x6d72c0 "hello world" | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4058b26c-4d9f-4e33-aa55-72af0afedb32 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,364 | supabase-export-v2 | aa96bca31756309d | ``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::
(gdb) py-print self
local 'self' = <SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>,
main_page=0) at remote 0x98fa6e4>
(gdb) py-print __name__
global '__name_... | trusted_official_docs | CPython Docs | ``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::
(gdb) py-print self
local 'self' = <SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>,
main_page=0) at remote 0x98fa6e4>
(gdb) py-print __name__
global '__name_... | ``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::
(gdb) py-print self
local 'self' = <SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>,
main_page=0) at remote 0x98fa6e4>
(gdb) py-print __name__
global '__name_... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
431576ba-7dfb-422f-8782-7ed40c4eebb8 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,365 | supabase-export-v2 | 4ab2be186d86a00a | at remote 0x98fa6e4> (gdb) py-print __name__ global '__name__' = 'gnome_sudoku.dialog_swallower' (gdb) py-print len builtin 'len' = <built-in function len> (gdb) py-print scarlet_pimpernel 'scarlet_pimpernel' not found
If the current C frame corresponds to multiple Python frames, ``py-print``
only considers the first ... | trusted_official_docs | CPython Docs | at remote 0x98fa6e4> (gdb) py-print __name__ global '__name__' = 'gnome_sudoku.dialog_swallower' (gdb) py-print len builtin 'len' = <built-in function len> (gdb) py-print scarlet_pimpernel 'scarlet_pimpernel' not found
If the current C frame corresponds to multiple Python frames, ``py-print``
only considers the first ... | at remote 0x98fa6e4> (gdb) py-print __name__ global '__name__' = 'gnome_sudoku.dialog_swallower' (gdb) py-print len builtin 'len' = <built-in function len> (gdb) py-print scarlet_pimpernel 'scarlet_pimpernel' not found
If the current C frame corresponds to multiple Python frames, ``py-print``
only considers the first ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
47168742-f8ad-46d1-a0b2-12fe7605229b | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,293 | supabase-export-v2 | 3dba15b505beb380 | 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.
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 def... | trusted_official_docs | CPython Docs | 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.
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 def... | 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.
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 def... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4b006868-1027-42a4-824f-e9ae38333cd9 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,326 | supabase-export-v2 | 8d7e031d23ec10a7 | ``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::
(gdb) p globals
$1 = {'__builtins__': <module at remote 0x7ffff7fb1868>, '__name__':
'__main__', 'ctypes': <module at remote 0x7ffff7f14360>, '__doc__': None,
'__package__':... | trusted_official_docs | CPython Docs | ``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::
(gdb) p globals
$1 = {'__builtins__': <module at remote 0x7ffff7fb1868>, '__name__':
'__main__', 'ctypes': <module at remote 0x7ffff7f14360>, '__doc__': None,
'__package__':... | ``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::
(gdb) p globals
$1 = {'__builtins__': <module at remote 0x7ffff7fb1868>, '__name__':
'__main__', 'ctypes': <module at remote 0x7ffff7f14360>, '__doc__': None,
'__package__':... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5477e11b-91c3-44de-ae9d-ed46b615a8bf | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,353 | supabase-export-v2 | ca56ed03374c17b3 | Going back down::
(gdb) py-down
#37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/gnome_sudoku/main.py, line 906, in start_game ()
u = UI()
(gdb) py-down
#34 (unable to read python frame information)
(gdb) py-down
#23 (unable to read python frame information)
(gdb) py-down
#19 (unable to read pytho... | trusted_official_docs | CPython Docs | Going back down::
(gdb) py-down
#37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/gnome_sudoku/main.py, line 906, in start_game ()
u = UI()
(gdb) py-down
#34 (unable to read python frame information)
(gdb) py-down
#23 (unable to read python frame information)
(gdb) py-down
#19 (unable to read pytho... | Going back down::
(gdb) py-down
#37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/gnome_sudoku/main.py, line 906, in start_game ()
u = UI()
(gdb) py-down
#34 (unable to read python frame information)
(gdb) py-down
#23 (unable to read python frame information)
(gdb) py-down
#19 (unable to read pytho... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
57bdad01-60de-411b-9147-90ca2ef108eb | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,345 | supabase-export-v2 | 5592dff4c049d12d | ``py-up`` and ``py-down`` -------------------------
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. | trusted_official_docs | CPython Docs | ``py-up`` and ``py-down`` -------------------------
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. | ``py-up`` and ``py-down`` -------------------------
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. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5dd52491-084c-4c46-83b7-522e5a6481e7 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,343 | supabase-export-v2 | 9d60ef7c3cd188ec | return 905 >906 u = UI() 907 if not u.quit: 908 try: 909 gtk.main() 910 except KeyboardInterrupt: 911 # properly quit on a keyboard interrupt...
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. | trusted_official_docs | CPython Docs | return 905 >906 u = UI() 907 if not u.quit: 908 try: 909 gtk.main() 910 except KeyboardInterrupt: 911 # properly quit on a keyboard interrupt...
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. | return 905 >906 u = UI() 907 if not u.quit: 908 try: 909 gtk.main() 910 except KeyboardInterrupt: 911 # properly quit on a keyboard interrupt...
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. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5f6a6e41-7399-4f40-8800-414158adac6b | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,297 | supabase-export-v2 | b1f3e43692e84792 | .. note::
This document assumes that you are familiar with the basics of GDB and the
CPython C API. It consolidates guidance from the
`devguide <https://devguide.python.org>`_ and the
`Python wiki <https://wiki.python.org/moin/DebuggingWithGdb>`_. | trusted_official_docs | CPython Docs | .. note::
This document assumes that you are familiar with the basics of GDB and the
CPython C API. It consolidates guidance from the
`devguide <https://devguide.python.org>`_ and the
`Python wiki <https://wiki.python.org/moin/DebuggingWithGdb>`_. | .. note::
This document assumes that you are familiar with the basics of GDB and the
CPython C API. It consolidates guidance from the
`devguide <https://devguide.python.org>`_ and the
`Python wiki <https://wiki.python.org/moin/DebuggingWithGdb>`_. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
67da5807-290d-4dab-9bc6-23f008bf5f10 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,380 | supabase-export-v2 | 6c4d9ce3840bd548 | self._acquire_restore(saved_state) #12 Frame 0x7fffac001c90, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 348, in f () cond.wait() #16 Frame 0x7fffac0011c0, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 37, in task (tid=140736940992272) f()
Thread 1 (Thread 0x7ffff7fe2700 (L... | trusted_official_docs | CPython Docs | self._acquire_restore(saved_state) #12 Frame 0x7fffac001c90, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 348, in f () cond.wait() #16 Frame 0x7fffac0011c0, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 37, in task (tid=140736940992272) f()
Thread 1 (Thread 0x7ffff7fe2700 (L... | self._acquire_restore(saved_state) #12 Frame 0x7fffac001c90, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 348, in f () cond.wait() #16 Frame 0x7fffac0011c0, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 37, in task (tid=140736940992272) f()
Thread 1 (Thread 0x7ffff7fe2700 (L... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
67f0814c-d90d-4e4d-a09c-2cf18fc8b194 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,342 | supabase-export-v2 | e18c40af4efca47f | command, which lists the Python source code (if any) for the current frame in the selected thread. The current line is marked with a ">"::
(gdb) py-list
901 if options.profile:
902 options.profile = False
903 profile_me()
904 return
905
>906 u = UI()
907 if not u.quit:
908 try:
909 gtk.main()
910 except Keybo... | trusted_official_docs | CPython Docs | command, which lists the Python source code (if any) for the current frame in the selected thread. The current line is marked with a ">"::
(gdb) py-list
901 if options.profile:
902 options.profile = False
903 profile_me()
904 return
905
>906 u = UI()
907 if not u.quit:
908 try:
909 gtk.main()
910 except Keybo... | command, which lists the Python source code (if any) for the current frame in the selected thread. The current line is marked with a ">"::
(gdb) py-list
901 if options.profile:
902 options.profile = False
903 profile_me()
904 return
905
>906 u = UI()
907 if not u.quit:
908 try:
909 gtk.main()
910 except Keybo... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7340b7d9-2abe-41f6-bfbd-45fe77ab04b5 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,379 | supabase-export-v2 | 55f307f0883939e5 | self._acquire_restore(saved_state) #12 Frame 0x7fffb8001a10, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 348, in f () cond.wait() #16 Frame 0x7fffb8001c40, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 37, in task (tid=140737213728528) f()
Thread 104 (Thread 0x7fffdf5fe710 ... | trusted_official_docs | CPython Docs | self._acquire_restore(saved_state) #12 Frame 0x7fffb8001a10, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 348, in f () cond.wait() #16 Frame 0x7fffb8001c40, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 37, in task (tid=140737213728528) f()
Thread 104 (Thread 0x7fffdf5fe710 ... | self._acquire_restore(saved_state) #12 Frame 0x7fffb8001a10, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 348, in f () cond.wait() #16 Frame 0x7fffb8001c40, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 37, in task (tid=140737213728528) f()
Thread 104 (Thread 0x7fffdf5fe710 ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
73f6a4c2-b6cc-45fd-ade5-bbf08333fee1 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,349 | supabase-export-v2 | 5b6e69ab4c9bad71 | For example::
(gdb) py-up
#37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/
gnome_sudoku/main.py, line 906, in start_game ()
u = UI()
(gdb) py-up
#40 Frame 0x948e82c, for file /usr/lib/python2.6/site-packages/
gnome_sudoku/gnome_sudoku.py, line 22, in start_game(main=<module at remote 0xb771b7f4>)
... | trusted_official_docs | CPython Docs | For example::
(gdb) py-up
#37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/
gnome_sudoku/main.py, line 906, in start_game ()
u = UI()
(gdb) py-up
#40 Frame 0x948e82c, for file /usr/lib/python2.6/site-packages/
gnome_sudoku/gnome_sudoku.py, line 22, in start_game(main=<module at remote 0xb771b7f4>)
... | For example::
(gdb) py-up
#37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/
gnome_sudoku/main.py, line 906, in start_game ()
u = UI()
(gdb) py-up
#40 Frame 0x948e82c, for file /usr/lib/python2.6/site-packages/
gnome_sudoku/gnome_sudoku.py, line 22, in start_game(main=<module at remote 0xb771b7f4>)
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7b19da05-3a97-478c-87b3-af9f86d80795 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,356 | supabase-export-v2 | 33cebf8931fd3c19 | 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::
(gdb) py-up
#6 Frame 0x7ffff7fb62b0, for file /tmp/rec.py, line 5, in recursive_function (n=0)
time.sleep(5)
#6 Frame 0x7ffff7fb6240, for file /tmp/rec.py, line 7... | trusted_official_docs | CPython Docs | 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::
(gdb) py-up
#6 Frame 0x7ffff7fb62b0, for file /tmp/rec.py, line 5, in recursive_function (n=0)
time.sleep(5)
#6 Frame 0x7ffff7fb6240, for file /tmp/rec.py, line 7... | 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::
(gdb) py-up
#6 Frame 0x7ffff7fb62b0, for file /tmp/rec.py, line 5, in recursive_function (n=0)
time.sleep(5)
#6 Frame 0x7ffff7fb6240, for file /tmp/rec.py, line 7... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7c8b4a6a-c7b4-4fee-8f37-ba44f0930781 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,294 | supabase-export-v2 | 3ce6b9612dc6d6bd | 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.
The ``python-gdb.py`` extension adds CPython interpreter information to GDB. The extension helps introspect the stack of currently executing Python function... | trusted_official_docs | CPython Docs | 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.
The ``python-gdb.py`` extension adds CPython interpreter information to GDB. The extension helps introspect the stack of currently executing Python function... | 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.
The ``python-gdb.py`` extension adds CPython interpreter information to GDB. The extension helps introspect the stack of currently executing Python function... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7e01a407-4373-4417-b2a5-e9d8158f3eab | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,299 | supabase-export-v2 | 219fa258502543ed | You need to have:
- GDB 7 or later. (For earlier versions of GDB, see ``Misc/gdbinit`` in the
sources of Python 3.11 or earlier.)
- GDB-compatible debugging information for Python and any extension you are
debugging. - The ``python-gdb.py`` extension. | trusted_official_docs | CPython Docs | You need to have:
- GDB 7 or later. (For earlier versions of GDB, see ``Misc/gdbinit`` in the
sources of Python 3.11 or earlier.)
- GDB-compatible debugging information for Python and any extension you are
debugging. - The ``python-gdb.py`` extension. | You need to have:
- GDB 7 or later. (For earlier versions of GDB, see ``Misc/gdbinit`` in the
sources of Python 3.11 or earlier.)
- GDB-compatible debugging information for Python and any extension you are
debugging. - The ``python-gdb.py`` extension. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7e15e9a6-356c-4966-b771-cc0492106735 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,318 | supabase-export-v2 | 1893c62ca313fb8b | ``configure --with-pydebug``. On Linux distros, install and run a package like ``python-debug`` or ``python-dbg``, if available.) - Use the runtime :ref:`development mode <devmode>` (``-X dev``).
Both enable extra assertions and disable some optimizations. Sometimes this hides the bug you are trying to find, but in mos... | trusted_official_docs | CPython Docs | ``configure --with-pydebug``. On Linux distros, install and run a package like ``python-debug`` or ``python-dbg``, if available.) - Use the runtime :ref:`development mode <devmode>` (``-X dev``).
Both enable extra assertions and disable some optimizations. Sometimes this hides the bug you are trying to find, but in mos... | ``configure --with-pydebug``. On Linux distros, install and run a package like ``python-debug`` or ``python-dbg``, if available.) - Use the runtime :ref:`development mode <devmode>` (``-X dev``).
Both enable extra assertions and disable some optimizations. Sometimes this hides the bug you are trying to find, but in mos... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
811ca100-e3c1-49f4-a3a4-3ec82ba6bd69 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,374 | supabase-export-v2 | 5200fc09e919daee | # change the CWD, the original CWD will be used. The original CWD is 1546 # available from test_support.SAVEDCWD. 1547 with test_support.temp_cwd(TESTCWD, quiet=True): >1548 main()
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 dif... | trusted_official_docs | CPython Docs | # change the CWD, the original CWD will be used. The original CWD is 1546 # available from test_support.SAVEDCWD. 1547 with test_support.temp_cwd(TESTCWD, quiet=True): >1548 main()
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 dif... | # change the CWD, the original CWD will be used. The original CWD is 1546 # available from test_support.SAVEDCWD. 1547 with test_support.temp_cwd(TESTCWD, quiet=True): >1548 main()
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 dif... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
865a5c25-3a66-4b80-b6fb-ad66246b6c1b | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,373 | supabase-export-v2 | c2f0a57aeb644a5f | 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::
(gdb) py-bt
(output snipped)
#68 Frame 0xaa4560, for file Lib/test/regrtest.py, line 1548, in <module> ()
main()
(gdb) frame 68
#68 0x00000000004cd1e6 in PyEval_EvalFram... | trusted_official_docs | CPython Docs | 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::
(gdb) py-bt
(output snipped)
#68 Frame 0xaa4560, for file Lib/test/regrtest.py, line 1548, in <module> ()
main()
(gdb) frame 68
#68 0x00000000004cd1e6 in PyEval_EvalFram... | 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::
(gdb) py-bt
(output snipped)
#68 Frame 0xaa4560, for file Lib/test/regrtest.py, line 1548, in <module> ()
main()
(gdb) frame 68
#68 0x00000000004cd1e6 in PyEval_EvalFram... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8f1101ba-05e4-4c90-83c7-4905dca9099b | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,334 | supabase-export-v2 | a87da4bc7049315e | (gdb) p *(PyLongObject*)some_python_integer $5 = {ob_base = {ob_base = {ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size = 1}, ob_digit = {42}}
A similar confusion can arise with the ``str`` type, where the output looks a
lot like gdb's built-in printer for ``char *``:: | trusted_official_docs | CPython Docs | (gdb) p *(PyLongObject*)some_python_integer $5 = {ob_base = {ob_base = {ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size = 1}, ob_digit = {42}}
A similar confusion can arise with the ``str`` type, where the output looks a
lot like gdb's built-in printer for ``char *``:: | (gdb) p *(PyLongObject*)some_python_integer $5 = {ob_base = {ob_base = {ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size = 1}, ob_digit = {42}}
A similar confusion can arise with the ``str`` type, where the output looks a
lot like gdb's built-in printer for ``char *``:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8f6141de-c8d2-4066-a709-2558b7117ba1 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,371 | supabase-export-v2 | 0df0e151f835eaa4 | recursive_function n = 2 Locals for recursive_function n = 3 Locals for recursive_function n = 4 Locals for recursive_function n = 5 Locals for <module>
Use with GDB commands
===================== | trusted_official_docs | CPython Docs | recursive_function n = 2 Locals for recursive_function n = 3 Locals for recursive_function n = 4 Locals for recursive_function n = 5 Locals for <module>
Use with GDB commands
===================== | recursive_function n = 2 Locals for recursive_function n = 3 Locals for recursive_function n = 4 Locals for recursive_function n = 5 Locals for <module>
Use with GDB commands
===================== | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
91089f09-e78e-46b0-b7f8-baf16b357832 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,314 | supabase-export-v2 | 7e883b8cf4593eb0 | sudo apt install gdb python3-dbg
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. | trusted_official_docs | CPython Docs | sudo apt install gdb python3-dbg
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. | sudo apt install gdb python3-dbg
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. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
937c14ca-714b-4925-9514-8087f1b61bfb | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,339 | supabase-export-v2 | fad9095658e40d20 | Again, the implementation details can be revealed with a cast to :c:expr:`PyUnicodeObject *`::
(gdb) p *(PyUnicodeObject*)$6
$8 = {ob_base = {ob_refcnt = 33, ob_type = 0x3dad3a95a0}, length = 12,
str = 0x7ffff2128500, hash = 7065186196740147912, state = 1, defenc = 0x0} | trusted_official_docs | CPython Docs | Again, the implementation details can be revealed with a cast to :c:expr:`PyUnicodeObject *`::
(gdb) p *(PyUnicodeObject*)$6
$8 = {ob_base = {ob_refcnt = 33, ob_type = 0x3dad3a95a0}, length = 12,
str = 0x7ffff2128500, hash = 7065186196740147912, state = 1, defenc = 0x0} | Again, the implementation details can be revealed with a cast to :c:expr:`PyUnicodeObject *`::
(gdb) p *(PyUnicodeObject*)$6
$8 = {ob_base = {ob_refcnt = 33, ob_type = 0x3dad3a95a0}, length = 12,
str = 0x7ffff2128500, hash = 7065186196740147912, state = 1, defenc = 0x0} | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
96d477cc-ef47-4f97-a1d5-91bd072db7af | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,330 | supabase-export-v2 | 29bcae82390ad5cc | 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::
(gdb) p some_machine_integer
$3 = 42 | trusted_official_docs | CPython Docs | 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::
(gdb) p some_machine_integer
$3 = 42 | 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::
(gdb) p some_machine_integer
$3 = 42 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9e2e802a-4a24-4c73-9e36-753dd59c867c | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,325 | supabase-export-v2 | a0d48275eaec3506 | Notice how the dictionary argument to ``PyDict_GetItemString`` is displayed as its ``repr()``, rather than an opaque ``PyObject *`` pointer.
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 poin... | trusted_official_docs | CPython Docs | Notice how the dictionary argument to ``PyDict_GetItemString`` is displayed as its ``repr()``, rather than an opaque ``PyObject *`` pointer.
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 poin... | Notice how the dictionary argument to ``PyDict_GetItemString`` is displayed as its ``repr()``, rather than an opaque ``PyObject *`` pointer.
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 poin... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a4842e20-a39a-4a51-b22e-d5e8146f1bb4 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,346 | supabase-export-v2 | e1386ba3d717c9dc | ``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.
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 ... | trusted_official_docs | CPython Docs | ``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.
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 ... | ``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.
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 ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a636109f-d0be-4289-ad08-4ad0f0aaf524 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,315 | supabase-export-v2 | d2f30513d1ad3187 | 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.
Using the Debug build and Development mode
========================================== | trusted_official_docs | CPython Docs | 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.
Using the Debug build and Development mode
========================================== | 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.
Using the Debug build and Development mode
========================================== | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
aa13483f-57e6-4fe6-8e34-5045f9ed0efa | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,327 | supabase-export-v2 | 807676a886b2358d | (gdb) p globals $1 = {'__builtins__': <module at remote 0x7ffff7fb1868>, '__name__': '__main__', 'ctypes': <module at remote 0x7ffff7f14360>, '__doc__': None, '__package__': None}
(gdb) p *(PyDictObject*)globals
$2 = {ob_refcnt = 3, ob_type = 0x3dbdf85820, ma_fill = 5, ma_used = 5,
ma_mask = 7, ma_table = 0x63d0f8, m... | trusted_official_docs | CPython Docs | (gdb) p globals $1 = {'__builtins__': <module at remote 0x7ffff7fb1868>, '__name__': '__main__', 'ctypes': <module at remote 0x7ffff7f14360>, '__doc__': None, '__package__': None}
(gdb) p *(PyDictObject*)globals
$2 = {ob_refcnt = 3, ob_type = 0x3dbdf85820, ma_fill = 5, ma_used = 5,
ma_mask = 7, ma_table = 0x63d0f8, m... | (gdb) p globals $1 = {'__builtins__': <module at remote 0x7ffff7fb1868>, '__name__': '__main__', 'ctypes': <module at remote 0x7ffff7f14360>, '__doc__': None, '__package__': None}
(gdb) p *(PyDictObject*)globals
$2 = {ob_refcnt = 3, ob_type = 0x3dbdf85820, ma_fill = 5, ma_used = 5,
ma_mask = 7, ma_table = 0x63d0f8, m... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b34b77dc-473e-4062-aa8a-8282c8b7629c | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,368 | supabase-export-v2 | 629f7ea274213574 | The ``py-locals`` command looks up all Python locals within the current Python frame in the selected thread, and prints their representations::
(gdb) py-locals
self = <SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>,
main_page=0) at remote 0x98fa6e4>
d = <gtk.Dialog at remote 0x98faaa4> | trusted_official_docs | CPython Docs | The ``py-locals`` command looks up all Python locals within the current Python frame in the selected thread, and prints their representations::
(gdb) py-locals
self = <SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>,
main_page=0) at remote 0x98fa6e4>
d = <gtk.Dialog at remote 0x98faaa4> | The ``py-locals`` command looks up all Python locals within the current Python frame in the selected thread, and prints their representations::
(gdb) py-locals
self = <SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>,
main_page=0) at remote 0x98fa6e4>
d = <gtk.Dialog at remote 0x98faaa4> | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b4bb5fbe-c80a-4051-bf3e-7cc220310402 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,355 | supabase-export-v2 | 4dbe4ca64d20c889 | and we're at the bottom of the Python stack.
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:: | trusted_official_docs | CPython Docs | and we're at the bottom of the Python stack.
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:: | and we're at the bottom of the Python stack.
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:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bdb5b165-0899-4ee1-a7f0-eca1a9ccda21 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,360 | supabase-export-v2 | 2e5ab9ac35e5a9c9 | For example::
(gdb) py-bt
#8 (unable to read python frame information)
#11 Frame 0x9aead74, for file /usr/lib/python2.6/site-packages/gnome_sudoku/dialog_swallower.py, line 48, in run_dialog (self=<SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>, main_page=0) at remote 0x98fa6e4>, d=<gtk.Dialog at remote 0x98f... | trusted_official_docs | CPython Docs | For example::
(gdb) py-bt
#8 (unable to read python frame information)
#11 Frame 0x9aead74, for file /usr/lib/python2.6/site-packages/gnome_sudoku/dialog_swallower.py, line 48, in run_dialog (self=<SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>, main_page=0) at remote 0x98fa6e4>, d=<gtk.Dialog at remote 0x98f... | For example::
(gdb) py-bt
#8 (unable to read python frame information)
#11 Frame 0x9aead74, for file /usr/lib/python2.6/site-packages/gnome_sudoku/dialog_swallower.py, line 48, in run_dialog (self=<SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>, main_page=0) at remote 0x98fa6e4>, d=<gtk.Dialog at remote 0x98f... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c00ce245-67bf-4ee6-8311-c8534f87d19f | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,301 | supabase-export-v2 | 7c441b7d0f1a260a | 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.
Setup with Python built from source
----------------------------------- | trusted_official_docs | CPython Docs | 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.
Setup with Python built from source
----------------------------------- | 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.
Setup with Python built from source
----------------------------------- | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c0dde844-48c5-40fd-b3f9-474fddc2b99d | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,376 | supabase-export-v2 | 275d5965b6afe89c | sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86 104 Thread 0x7fffdf5fe710 (LWP 10259) sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86 * 1 Thread 0x7ffff7fe2700 (LWP 10145) 0x00000038e46d73e3 in select () at ../sysdeps/unix/syscall-template.S:82
You can use ``thread apply all COMM... | trusted_official_docs | CPython Docs | sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86 104 Thread 0x7fffdf5fe710 (LWP 10259) sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86 * 1 Thread 0x7ffff7fe2700 (LWP 10145) 0x00000038e46d73e3 in select () at ../sysdeps/unix/syscall-template.S:82
You can use ``thread apply all COMM... | sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86 104 Thread 0x7fffdf5fe710 (LWP 10259) sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86 * 1 Thread 0x7ffff7fe2700 (LWP 10145) 0x00000038e46d73e3 in select () at ../sysdeps/unix/syscall-template.S:82
You can use ``thread apply all COMM... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c10ff40e-a119-4d66-8c77-9a5e963902d6 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,333 | supabase-export-v2 | 3e0756c8c0158026 | The internal structure can be revealed with a cast to :c:expr:`PyLongObject *`::
(gdb) p *(PyLongObject*)some_python_integer
$5 = {ob_base = {ob_base = {ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size = 1},
ob_digit = {42}} | trusted_official_docs | CPython Docs | The internal structure can be revealed with a cast to :c:expr:`PyLongObject *`::
(gdb) p *(PyLongObject*)some_python_integer
$5 = {ob_base = {ob_base = {ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size = 1},
ob_digit = {42}} | The internal structure can be revealed with a cast to :c:expr:`PyLongObject *`::
(gdb) p *(PyLongObject*)some_python_integer
$5 = {ob_base = {ob_base = {ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size = 1},
ob_digit = {42}} | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c27b6403-565b-46cb-9ebe-43855fcc9378 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,300 | supabase-export-v2 | 9b54e5318490b2fb | ``Misc/gdbinit`` in the sources of Python 3.11 or earlier.) - GDB-compatible debugging information for Python and any extension you are debugging. - The ``python-gdb.py`` extension.
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 ... | trusted_official_docs | CPython Docs | ``Misc/gdbinit`` in the sources of Python 3.11 or earlier.) - GDB-compatible debugging information for Python and any extension you are debugging. - The ``python-gdb.py`` extension.
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 ... | ``Misc/gdbinit`` in the sources of Python 3.11 or earlier.) - GDB-compatible debugging information for Python and any extension you are debugging. - The ``python-gdb.py`` extension.
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 ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cbc4905c-3175-471c-931d-aaffc9eef614 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,354 | supabase-export-v2 | 9ab341d12a94dd16 | remote 0x98fa6e4>, d=<gtk.Dialog at remote 0x98faaa4>) gtk.main() (gdb) py-down #8 (unable to read python frame information) (gdb) py-down Unable to find a newer python frame
and we're at the bottom of the Python stack. | trusted_official_docs | CPython Docs | remote 0x98fa6e4>, d=<gtk.Dialog at remote 0x98faaa4>) gtk.main() (gdb) py-down #8 (unable to read python frame information) (gdb) py-down Unable to find a newer python frame
and we're at the bottom of the Python stack. | remote 0x98fa6e4>, d=<gtk.Dialog at remote 0x98faaa4>) gtk.main() (gdb) py-down #8 (unable to read python frame information) (gdb) py-down Unable to find a newer python frame
and we're at the bottom of the Python stack. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e1615bc0-3197-4344-ba9f-5906bcaa31e8 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,369 | supabase-export-v2 | 960c8b63f713303a | (gdb) py-locals self = <SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>, main_page=0) at remote 0x98fa6e4> d = <gtk.Dialog at remote 0x98faaa4>
If the current C frame corresponds to multiple Python frames, locals from
all of them will be shown:: | trusted_official_docs | CPython Docs | (gdb) py-locals self = <SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>, main_page=0) at remote 0x98fa6e4> d = <gtk.Dialog at remote 0x98faaa4>
If the current C frame corresponds to multiple Python frames, locals from
all of them will be shown:: | (gdb) py-locals self = <SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>, main_page=0) at remote 0x98fa6e4> d = <gtk.Dialog at remote 0x98faaa4>
If the current C frame corresponds to multiple Python frames, locals from
all of them will be shown:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e9cce7cf-5fb1-435b-ab16-25d2063a30a9 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,317 | supabase-export-v2 | e0d869426f4fe600 | For easier debugging, you might want to:
- Use a :ref:`debug build <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.)
- Use the runtime :ref:`development mode <devmode>` (``-X dev``... | trusted_official_docs | CPython Docs | For easier debugging, you might want to:
- Use a :ref:`debug build <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.)
- Use the runtime :ref:`development mode <devmode>` (``-X dev``... | For easier debugging, you might want to:
- Use a :ref:`debug build <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.)
- Use the runtime :ref:`development mode <devmode>` (``-X dev``... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
eca8d95e-7ca8-40b8-92fe-e81dcbdea872 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,347 | supabase-export-v2 | e811c82692778e12 | executing the default frame evaluation function (that is, the core bytecode interpreter loop within CPython) and look up the value of the related ``PyFrameObject *``.
They emit the frame number (at the C level) within the thread. | trusted_official_docs | CPython Docs | executing the default frame evaluation function (that is, the core bytecode interpreter loop within CPython) and look up the value of the related ``PyFrameObject *``.
They emit the frame number (at the C level) within the thread. | executing the default frame evaluation function (that is, the core bytecode interpreter loop within CPython) and look up the value of the related ``PyFrameObject *``.
They emit the frame number (at the C level) within the thread. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ecb82206-b3df-415b-9443-3c63626e6a79 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,351 | supabase-export-v2 | 1da1d214f56a0726 | so we're at the top of the Python stack.
The frame numbers correspond to those displayed by GDB's standard
``backtrace`` command. The command skips C frames which are not executing Python code. | trusted_official_docs | CPython Docs | so we're at the top of the Python stack.
The frame numbers correspond to those displayed by GDB's standard
``backtrace`` command. The command skips C frames which are not executing Python code. | so we're at the top of the Python stack.
The frame numbers correspond to those displayed by GDB's standard
``backtrace`` command. The command skips C frames which are not executing Python code. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f161cbef-0952-4830-8feb-f85e7a595b6f | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,336 | supabase-export-v2 | 3e9cfc978e1c4b1f | (gdb) p ptr_to_python_str $6 = '__builtins__'
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:: | trusted_official_docs | CPython Docs | (gdb) p ptr_to_python_str $6 = '__builtins__'
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:: | (gdb) p ptr_to_python_str $6 = '__builtins__'
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:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f269d492-a92d-492c-acff-3e5597052d20 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,361 | supabase-export-v2 | f79b3001018876d4 | file /usr/lib/python2.6/site-packages/gnome_sudoku/main.py, line 906, in start_game () u = UI() #40 Frame 0x948e82c, for file /usr/lib/python2.6/site-packages/gnome_sudoku/gnome_sudoku.py, line 22, in start_game (main=<module at remote 0xb771b7f4>) main.start_game()
The frame numbers correspond to those displayed by GD... | trusted_official_docs | CPython Docs | file /usr/lib/python2.6/site-packages/gnome_sudoku/main.py, line 906, in start_game () u = UI() #40 Frame 0x948e82c, for file /usr/lib/python2.6/site-packages/gnome_sudoku/gnome_sudoku.py, line 22, in start_game (main=<module at remote 0xb771b7f4>) main.start_game()
The frame numbers correspond to those displayed by GD... | file /usr/lib/python2.6/site-packages/gnome_sudoku/main.py, line 906, in start_game () u = UI() #40 Frame 0x948e82c, for file /usr/lib/python2.6/site-packages/gnome_sudoku/gnome_sudoku.py, line 22, in start_game (main=<module at remote 0xb771b7f4>) main.start_game()
The frame numbers correspond to those displayed by GD... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f6c9ec48-2df1-4c60-a50e-4dd2c0a91776 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,377 | supabase-export-v2 | 40e94895626b92ef | 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::
(gdb) t a a py-bt | trusted_official_docs | CPython Docs | 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::
(gdb) t a a py-bt | 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::
(gdb) t a a py-bt | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f857f722-9029-43e5-9e28-936bf84d2f80 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,302 | supabase-export-v2 | 4770063acaa2611b | Setup with Python built from source -----------------------------------
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. | trusted_official_docs | CPython Docs | Setup with Python built from source -----------------------------------
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. | Setup with Python built from source -----------------------------------
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. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ffb09bdd-042e-423a-8d91-36f2eb61f1f2 | CPython Docs | file://datasets/cpython/Doc/howto/gdb_helpers.rst | unknown | 4697ae04-90df-4433-841a-1333ce583038 | 57,370 | supabase-export-v2 | e49668e9de641152 | If the current C frame corresponds to multiple Python frames, locals from all of them will be shown::
(gdb) py-locals
Locals for recursive_function
n = 0
Locals for recursive_function
n = 1
Locals for recursive_function
n = 2
Locals for recursive_function
n = 3
Locals for recursive_function
n = 4
Locals for ... | trusted_official_docs | CPython Docs | If the current C frame corresponds to multiple Python frames, locals from all of them will be shown::
(gdb) py-locals
Locals for recursive_function
n = 0
Locals for recursive_function
n = 1
Locals for recursive_function
n = 2
Locals for recursive_function
n = 3
Locals for recursive_function
n = 4
Locals for ... | If the current C frame corresponds to multiple Python frames, locals from all of them will be shown::
(gdb) py-locals
Locals for recursive_function
n = 0
Locals for recursive_function
n = 1
Locals for recursive_function
n = 2
Locals for recursive_function
n = 3
Locals for recursive_function
n = 4
Locals for ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
00a85e31-2e50-42d2-a8f9-5d93ec2cf3b2 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,633 | supabase-export-v2 | fd10c0fb783e37a5 | >>> print(re.search('super', 'superstition').span()) (0, 5) >>> print(re.search('super', 'insuperable').span()) (2, 7)
This distinction is important to remember when using the old :func:`~re.match`
name in code requiring compatibility with older Python versions. | trusted_official_docs | CPython Docs | >>> print(re.search('super', 'superstition').span()) (0, 5) >>> print(re.search('super', 'insuperable').span()) (2, 7)
This distinction is important to remember when using the old :func:`~re.match`
name in code requiring compatibility with older Python versions. | >>> print(re.search('super', 'superstition').span()) (0, 5) >>> print(re.search('super', 'insuperable').span()) (2, 7)
This distinction is important to remember when using the old :func:`~re.match`
name in code requiring compatibility with older Python versions. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
02a355d5-8130-4732-b5c8-0f86faa7a60e | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,433 | supabase-export-v2 | eecb98238c51872b | >>> import re >>> p = re.compile('ab*') >>> p re.compile('ab*')
:func:`re.compile` also accepts an optional *flags* argument, used to enable
various special features and syntax variations. We'll go over the available
settings later, but for now a single example will do:: | trusted_official_docs | CPython Docs | >>> import re >>> p = re.compile('ab*') >>> p re.compile('ab*')
:func:`re.compile` also accepts an optional *flags* argument, used to enable
various special features and syntax variations. We'll go over the available
settings later, but for now a single example will do:: | >>> import re >>> p = re.compile('ab*') >>> p re.compile('ab*')
:func:`re.compile` also accepts an optional *flags* argument, used to enable
various special features and syntax variations. We'll go over the available
settings later, but for now a single example will do:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
07ab7c7d-1e54-4f45-ac78-2e2462126d4b | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,414 | supabase-export-v2 | 3f2d00a25a1c6923 | Repeating things ----------------
Being able to match varying sets of characters is the first thing regular
expressions can do that isn't already possible with the methods available on
strings. However, if that was the only additional capability of regexes, they
wouldn't be much of an advance. Another capability is tha... | trusted_official_docs | CPython Docs | Repeating things ----------------
Being able to match varying sets of characters is the first thing regular
expressions can do that isn't already possible with the methods available on
strings. However, if that was the only additional capability of regexes, they
wouldn't be much of an advance. Another capability is tha... | Repeating things ----------------
Being able to match varying sets of characters is the first thing regular
expressions can do that isn't already possible with the methods available on
strings. However, if that was the only additional capability of regexes, they
wouldn't be much of an advance. Another capability is tha... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0851d9b4-b6c5-4d1a-ad1f-86a1fff43139 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,572 | supabase-export-v2 | cb443b776cd68dc3 | ``.*[.].*$``
Notice that the ``.`` needs to be treated specially because it's a
metacharacter, so it's inside a character class to only match that
specific character. Also notice the trailing ``$``; this is added to
ensure that all the rest of the string must be included in the
extension. This regular expression matche... | trusted_official_docs | CPython Docs | ``.*[.].*$``
Notice that the ``.`` needs to be treated specially because it's a
metacharacter, so it's inside a character class to only match that
specific character. Also notice the trailing ``$``; this is added to
ensure that all the rest of the string must be included in the
extension. This regular expression matche... | ``.*[.].*$``
Notice that the ``.`` needs to be treated specially because it's a
metacharacter, so it's inside a character class to only match that
specific character. Also notice the trailing ``$``; this is added to
ensure that all the rest of the string must be included in the
extension. This regular expression matche... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0925667c-1804-41cb-8c93-3df19d58d5b9 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,649 | supabase-export-v2 | d3080925bf1f3d68 | Feedback ========
Regular expressions are a complicated topic. Did this document help you
understand them? Were there parts that were unclear, or problems you
encountered that weren't covered here? If so, please send suggestions for
improvements to the :ref:`issue tracker <using-the-tracker>`. | trusted_official_docs | CPython Docs | Feedback ========
Regular expressions are a complicated topic. Did this document help you
understand them? Were there parts that were unclear, or problems you
encountered that weren't covered here? If so, please send suggestions for
improvements to the :ref:`issue tracker <using-the-tracker>`. | Feedback ========
Regular expressions are a complicated topic. Did this document help you
understand them? Were there parts that were unclear, or problems you
encountered that weren't covered here? If so, please send suggestions for
improvements to the :ref:`issue tracker <using-the-tracker>`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0a95db1b-dee5-4c65-bc26-90e83b3a3f58 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,617 | supabase-export-v2 | 3bed5f472232c338 | In the following example, the replacement function translates decimals into hexadecimal::
>>> def hexrepl(match):
... "Return the hex string for a decimal number"
... value = int(match.group())
... return hex(value)
... >>> p = re.compile(r'\d+')
>>> p.sub(hexrepl, 'Call 65490 for printing, 49152 for user code.')
... | trusted_official_docs | CPython Docs | In the following example, the replacement function translates decimals into hexadecimal::
>>> def hexrepl(match):
... "Return the hex string for a decimal number"
... value = int(match.group())
... return hex(value)
... >>> p = re.compile(r'\d+')
>>> p.sub(hexrepl, 'Call 65490 for printing, 49152 for user code.')
... | In the following example, the replacement function translates decimals into hexadecimal::
>>> def hexrepl(match):
... "Return the hex string for a decimal number"
... value = int(match.group())
... return hex(value)
... >>> p = re.compile(r'\d+')
>>> p.sub(hexrepl, 'Call 65490 for printing, 49152 for user code.')
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0e5973a5-ec1d-4499-9a3c-85513cd2f92a | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,602 | supabase-export-v2 | a30ec4a547d16eae | .. method:: .sub(replacement, string[, count=0]) :noindex:
Returns the string obtained by replacing the leftmost non-overlapping
occurrences of the RE in *string* by the replacement *replacement*. If the
pattern isn't found, *string* is returned unchanged. | trusted_official_docs | CPython Docs | .. method:: .sub(replacement, string[, count=0]) :noindex:
Returns the string obtained by replacing the leftmost non-overlapping
occurrences of the RE in *string* by the replacement *replacement*. If the
pattern isn't found, *string* is returned unchanged. | .. method:: .sub(replacement, string[, count=0]) :noindex:
Returns the string obtained by replacing the leftmost non-overlapping
occurrences of the RE in *string* by the replacement *replacement*. If the
pattern isn't found, *string* is returned unchanged. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0ea6440c-4192-47ac-9474-c2d17be92aeb | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,442 | supabase-export-v2 | 365fa804a926328b | to be matched | +-------------------+------------------------------------------+ | ``\\section`` | Escaped backslash for :func:`re.compile` | +-------------------+------------------------------------------+ | ``"\\\\section"`` | Escaped backslashes for a string literal | +-------------------+---------------------------... | trusted_official_docs | CPython Docs | to be matched | +-------------------+------------------------------------------+ | ``\\section`` | Escaped backslash for :func:`re.compile` | +-------------------+------------------------------------------+ | ``"\\\\section"`` | Escaped backslashes for a string literal | +-------------------+---------------------------... | to be matched | +-------------------+------------------------------------------+ | ``\\section`` | Escaped backslash for :func:`re.compile` | +-------------------+------------------------------------------+ | ``"\\\\section"`` | Escaped backslashes for a string literal | +-------------------+---------------------------... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0f35c556-06a8-4a44-96a0-d34b5334b353 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,392 | supabase-export-v2 | 55e23b5ef2e642c2 | learning about the simplest possible regular expressions. Since regular expressions are used to operate on strings, we'll begin with the most common task: matching characters.
For a detailed explanation of the computer science underlying regular
expressions (deterministic and non-deterministic finite automata), you can... | trusted_official_docs | CPython Docs | learning about the simplest possible regular expressions. Since regular expressions are used to operate on strings, we'll begin with the most common task: matching characters.
For a detailed explanation of the computer science underlying regular
expressions (deterministic and non-deterministic finite automata), you can... | learning about the simplest possible regular expressions. Since regular expressions are used to operate on strings, we'll begin with the most common task: matching characters.
For a detailed explanation of the computer science underlying regular
expressions (deterministic and non-deterministic finite automata), you can... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0fdfcf21-425a-4a64-ab0b-eb179a7200e7 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,399 | supabase-export-v2 | f8a48ea049cc0443 | ``[a-c]``, which uses a range to express the same set of characters. If you wanted to match only lowercase letters, your RE would be ``[a-z]``.
Metacharacters (except ``\``) are not active inside classes. For example, ``[akm$]`` will
match any of the characters ``'a'``, ``'k'``, ``'m'``, or ``'$'``; ``'$'`` is
usually ... | trusted_official_docs | CPython Docs | ``[a-c]``, which uses a range to express the same set of characters. If you wanted to match only lowercase letters, your RE would be ``[a-z]``.
Metacharacters (except ``\``) are not active inside classes. For example, ``[akm$]`` will
match any of the characters ``'a'``, ``'k'``, ``'m'``, or ``'$'``; ``'$'`` is
usually ... | ``[a-c]``, which uses a range to express the same set of characters. If you wanted to match only lowercase letters, your RE would be ``[a-z]``.
Metacharacters (except ``\``) are not active inside classes. For example, ``[akm$]`` will
match any of the characters ``'a'``, ``'k'``, ``'m'``, or ``'$'``; ``'$'`` is
usually ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0feec506-1d11-4516-b0e4-2b28899360ae | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,423 | supabase-export-v2 | 58378a1723056dc2 | ``+`` requires at least *one* occurrence. To use a similar example, ``ca+t`` will match ``'cat'`` (1 ``'a'``), ``'caaat'`` (3 ``'a'``\ s), but won't match ``'ct'``.
There are two more repeating operators or quantifiers. The question mark character, ``?``,
matches either once or zero times; you can think of it as markin... | trusted_official_docs | CPython Docs | ``+`` requires at least *one* occurrence. To use a similar example, ``ca+t`` will match ``'cat'`` (1 ``'a'``), ``'caaat'`` (3 ``'a'``\ s), but won't match ``'ct'``.
There are two more repeating operators or quantifiers. The question mark character, ``?``,
matches either once or zero times; you can think of it as markin... | ``+`` requires at least *one* occurrence. To use a similar example, ``ca+t`` will match ``'cat'`` (1 ``'a'``), ``'caaat'`` (3 ``'a'``\ s), but won't match ``'ct'``.
There are two more repeating operators or quantifiers. The question mark character, ``?``,
matches either once or zero times; you can think of it as markin... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
101ae48d-28fe-4fe5-a5c2-1a76584c3d11 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,623 | supabase-export-v2 | 7d625e777f622d49 | faster, because the implementation is a single small C loop that's been optimized for the purpose, instead of the large, more generalized regular expression engine.
One example might be replacing a single fixed string with another one; for
example, you might replace ``word`` with ``deed``. :func:`re.sub` seems like the... | trusted_official_docs | CPython Docs | faster, because the implementation is a single small C loop that's been optimized for the purpose, instead of the large, more generalized regular expression engine.
One example might be replacing a single fixed string with another one; for
example, you might replace ``word`` with ``deed``. :func:`re.sub` seems like the... | faster, because the implementation is a single small C loop that's been optimized for the purpose, instead of the large, more generalized regular expression engine.
One example might be replacing a single fixed string with another one; for
example, you might replace ``word`` with ``deed``. :func:`re.sub` seems like the... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1276deea-7db0-49cf-af73-337de173645b | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,598 | supabase-export-v2 | f39f020050cb8939 | The module-level function :func:`re.split` adds the RE to be used as the first argument, but is otherwise the same. ::
>>> re.split(r'[\W]+', 'Words, words, words.')
['Words', 'words', 'words', '']
>>> re.split(r'([\W]+)', 'Words, words, words.')
['Words', ', ', 'words', ', ', 'words', '.', '']
>>> re.split(r'[\W]+... | trusted_official_docs | CPython Docs | The module-level function :func:`re.split` adds the RE to be used as the first argument, but is otherwise the same. ::
>>> re.split(r'[\W]+', 'Words, words, words.')
['Words', 'words', 'words', '']
>>> re.split(r'([\W]+)', 'Words, words, words.')
['Words', ', ', 'words', ', ', 'words', '.', '']
>>> re.split(r'[\W]+... | The module-level function :func:`re.split` adds the RE to be used as the first argument, but is otherwise the same. ::
>>> re.split(r'[\W]+', 'Words, words, words.')
['Words', 'words', 'words', '']
>>> re.split(r'([\W]+)', 'Words, words, words.')
['Words', ', ', 'words', ', ', 'words', '.', '']
>>> re.split(r'[\W]+... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
12cf5567-54ab-4d54-a634-ea84b2944484 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,550 | supabase-export-v2 | 2590c8d7b55997dd | extension is being used, so ``(?=foo)`` is one thing (a positive lookahead assertion) and ``(?:foo)`` is something else (a non-capturing group containing the subexpression ``foo``).
Python supports several of Perl's extensions and adds an extension
syntax to Perl's extension syntax. If the first character after the
que... | trusted_official_docs | CPython Docs | extension is being used, so ``(?=foo)`` is one thing (a positive lookahead assertion) and ``(?:foo)`` is something else (a non-capturing group containing the subexpression ``foo``).
Python supports several of Perl's extensions and adds an extension
syntax to Perl's extension syntax. If the first character after the
que... | extension is being used, so ``(?=foo)`` is one thing (a positive lookahead assertion) and ``(?:foo)`` is something else (a non-capturing group containing the subexpression ``foo``).
Python supports several of Perl's extensions and adds an extension
syntax to Perl's extension syntax. If the first character after the
que... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
16ece88c-ec1f-409e-985e-89a539d7aa67 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,594 | supabase-export-v2 | 50d214e568099421 | of the string is returned as the final element of the list. In the following example, the delimiter is any sequence of non-alphanumeric characters. ::
>>> p = re.compile(r'\W+')
>>> p.split('This is a test, short and sweet, of split().')
['This', 'is', 'a', 'test', 'short', 'and', 'sweet', 'of', 'split', '']
>>> p.s... | trusted_official_docs | CPython Docs | of the string is returned as the final element of the list. In the following example, the delimiter is any sequence of non-alphanumeric characters. ::
>>> p = re.compile(r'\W+')
>>> p.split('This is a test, short and sweet, of split().')
['This', 'is', 'a', 'test', 'short', 'and', 'sweet', 'of', 'split', '']
>>> p.s... | of the string is returned as the final element of the list. In the following example, the delimiter is any sequence of non-alphanumeric characters. ::
>>> p = re.compile(r'\W+')
>>> p.split('This is a test, short and sweet, of split().')
['This', 'is', 'a', 'test', 'short', 'and', 'sweet', 'of', 'split', '']
>>> p.s... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
17990b18-a428-4822-8419-3aff4f5638a4 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,467 | supabase-export-v2 | 731d0a0f0e8f7a6e | Two pattern methods return all of the matches for a pattern. :meth:`~re.Pattern.findall` returns a list of matching strings::
>>> p = re.compile(r'\d+')
>>> p.findall('12 drummers drumming, 11 pipers piping, 10 lords a-leaping')
['12', '11', '10'] | trusted_official_docs | CPython Docs | Two pattern methods return all of the matches for a pattern. :meth:`~re.Pattern.findall` returns a list of matching strings::
>>> p = re.compile(r'\d+')
>>> p.findall('12 drummers drumming, 11 pipers piping, 10 lords a-leaping')
['12', '11', '10'] | Two pattern methods return all of the matches for a pattern. :meth:`~re.Pattern.findall` returns a list of matching strings::
>>> p = re.compile(r'\d+')
>>> p.findall('12 drummers drumming, 11 pipers piping, 10 lords a-leaping')
['12', '11', '10'] | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
192092cc-3404-4efd-934d-0d3bc6ee4cbf | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,440 | supabase-export-v2 | 39f334515925759b | characters to be used without invoking their special meaning. This conflicts with Python's usage of the same character for the same purpose in string literals.
Let's say you want to write a RE that matches the string ``\section``, which
might be found in a LaTeX file. To figure out what to write in the program
code, st... | trusted_official_docs | CPython Docs | characters to be used without invoking their special meaning. This conflicts with Python's usage of the same character for the same purpose in string literals.
Let's say you want to write a RE that matches the string ``\section``, which
might be found in a LaTeX file. To figure out what to write in the program
code, st... | characters to be used without invoking their special meaning. This conflicts with Python's usage of the same character for the same purpose in string literals.
Let's say you want to write a RE that matches the string ``\section``, which
might be found in a LaTeX file. To figure out what to write in the program
code, st... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1a151ff7-f57f-47bc-882a-7f9250df0c66 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,463 | supabase-export-v2 | f8c5c917d6f62013 | the :meth:`~re.Pattern.prefixmatch` method only checks if the RE matches at the start of a string, so :meth:`!start` will always be zero in that case. ::
>>> m = p.search('::: message'); print(m)
<re.Match object; span=(4, 11), match='message'>
>>> m.group()
'message'
>>> m.span()
(4, 11)
>>> print(p.prefixmatch(... | trusted_official_docs | CPython Docs | the :meth:`~re.Pattern.prefixmatch` method only checks if the RE matches at the start of a string, so :meth:`!start` will always be zero in that case. ::
>>> m = p.search('::: message'); print(m)
<re.Match object; span=(4, 11), match='message'>
>>> m.group()
'message'
>>> m.span()
(4, 11)
>>> print(p.prefixmatch(... | the :meth:`~re.Pattern.prefixmatch` method only checks if the RE matches at the start of a string, so :meth:`!start` will always be zero in that case. ::
>>> m = p.search('::: message'); print(m)
<re.Match object; span=(4, 11), match='message'>
>>> m.group()
'message'
>>> m.span()
(4, 11)
>>> print(p.prefixmatch(... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1af5b33b-3060-4b76-acdb-3761377635cb | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,472 | supabase-export-v2 | 354e055f669d7a52 | Module-level functions ----------------------
You don't have to create a pattern object and call its methods; the
:mod:`re` module also provides top-level functions called :func:`~re.search`,
:func:`~re.prefixmatch`, :func:`~re.findall`, :func:`~re.sub`, and so forth. These functions
take the same arguments as the corr... | trusted_official_docs | CPython Docs | Module-level functions ----------------------
You don't have to create a pattern object and call its methods; the
:mod:`re` module also provides top-level functions called :func:`~re.search`,
:func:`~re.prefixmatch`, :func:`~re.findall`, :func:`~re.sub`, and so forth. These functions
take the same arguments as the corr... | Module-level functions ----------------------
You don't have to create a pattern object and call its methods; the
:mod:`re` module also provides top-level functions called :func:`~re.search`,
:func:`~re.prefixmatch`, :func:`~re.findall`, :func:`~re.sub`, and so forth. These functions
take the same arguments as the corr... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1b383b40-7511-47b3-bfdd-58c67e1676c0 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,468 | supabase-export-v2 | d4a98be22667b547 | >>> p = re.compile(r'\d+') >>> p.findall('12 drummers drumming, 11 pipers piping, 10 lords a-leaping') ['12', '11', '10']
The ``r`` prefix, making the literal a raw string literal, is needed in this
example because escape sequences in a normal "cooked" string literal that are
not recognized by Python, as opposed to reg... | trusted_official_docs | CPython Docs | >>> p = re.compile(r'\d+') >>> p.findall('12 drummers drumming, 11 pipers piping, 10 lords a-leaping') ['12', '11', '10']
The ``r`` prefix, making the literal a raw string literal, is needed in this
example because escape sequences in a normal "cooked" string literal that are
not recognized by Python, as opposed to reg... | >>> p = re.compile(r'\d+') >>> p.findall('12 drummers drumming, 11 pipers piping, 10 lords a-leaping') ['12', '11', '10']
The ``r`` prefix, making the literal a raw string literal, is needed in this
example because escape sequences in a normal "cooked" string literal that are
not recognized by Python, as opposed to reg... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1b738015-05b9-4aeb-a504-3d6ce66c0f27 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,650 | supabase-export-v2 | 68157a395568c590 | there parts that were unclear, or problems you encountered that weren't covered here? If so, please send suggestions for improvements to the :ref:`issue tracker <using-the-tracker>`.
The most complete book on regular expressions is almost certainly Jeffrey
Friedl's Mastering Regular Expressions, published by O'Reilly. ... | trusted_official_docs | CPython Docs | there parts that were unclear, or problems you encountered that weren't covered here? If so, please send suggestions for improvements to the :ref:`issue tracker <using-the-tracker>`.
The most complete book on regular expressions is almost certainly Jeffrey
Friedl's Mastering Regular Expressions, published by O'Reilly. ... | there parts that were unclear, or problems you encountered that weren't covered here? If so, please send suggestions for improvements to the :ref:`issue tracker <using-the-tracker>`.
The most complete book on regular expressions is almost certainly Jeffrey
Friedl's Mastering Regular Expressions, published by O'Reilly. ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1e464b7a-8304-44b6-abc3-88ca2e9abfbb | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,464 | supabase-export-v2 | 694c722490d29535 | >>> m = p.search('::: message'); print(m) <re.Match object; span=(4, 11), match='message'> >>> m.group() 'message' >>> m.span() (4, 11) >>> print(p.prefixmatch('::: message')) None
In actual programs, the most common style is to store the
:ref:`match object <match-objects>` in a variable, and then check if it was
``Non... | trusted_official_docs | CPython Docs | >>> m = p.search('::: message'); print(m) <re.Match object; span=(4, 11), match='message'> >>> m.group() 'message' >>> m.span() (4, 11) >>> print(p.prefixmatch('::: message')) None
In actual programs, the most common style is to store the
:ref:`match object <match-objects>` in a variable, and then check if it was
``Non... | >>> m = p.search('::: message'); print(m) <re.Match object; span=(4, 11), match='message'> >>> m.group() 'message' >>> m.span() (4, 11) >>> print(p.prefixmatch('::: message')) None
In actual programs, the most common style is to store the
:ref:`match object <match-objects>` in a variable, and then check if it was
``Non... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1efc6a09-a7f7-4313-a81f-a15f3d7c30f7 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,475 | supabase-export-v2 | 2e82b4b53fa18f2a | They also store the compiled object in a cache, so future calls using the same RE won't need to parse the pattern again and again.
Should you use these module-level functions, or should you get the
pattern and call its methods yourself? If you're accessing a regex
within a loop, pre-compiling it will save a few functio... | trusted_official_docs | CPython Docs | They also store the compiled object in a cache, so future calls using the same RE won't need to parse the pattern again and again.
Should you use these module-level functions, or should you get the
pattern and call its methods yourself? If you're accessing a regex
within a loop, pre-compiling it will save a few functio... | They also store the compiled object in a cache, so future calls using the same RE won't need to parse the pattern again and again.
Should you use these module-level functions, or should you get the
pattern and call its methods yourself? If you're accessing a regex
within a loop, pre-compiling it will save a few functio... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
20f50ce9-5cda-4a24-830d-66509c72d05b | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,590 | supabase-export-v2 | 09a44425e3e326c3 | Splitting strings -----------------
The :meth:`~re.Pattern.split` method of a pattern splits a string apart
wherever the RE matches, returning a list of the pieces. It's similar to the
:meth:`~str.split` method of strings but provides much more generality in the
delimiters that you can split by; string :meth:`!split` o... | trusted_official_docs | CPython Docs | Splitting strings -----------------
The :meth:`~re.Pattern.split` method of a pattern splits a string apart
wherever the RE matches, returning a list of the pieces. It's similar to the
:meth:`~str.split` method of strings but provides much more generality in the
delimiters that you can split by; string :meth:`!split` o... | Splitting strings -----------------
The :meth:`~re.Pattern.split` method of a pattern splits a string apart
wherever the RE matches, returning a list of the pieces. It's similar to the
:meth:`~str.split` method of strings but provides much more generality in the
delimiters that you can split by; string :meth:`!split` o... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
21653959-7a7b-40a7-ad68-d1cd16f7abbc | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,456 | supabase-export-v2 | 3111e715c450e61a | >>> p.search("") >>> print(p.search("")) None
Now, let's try it on a string that it should match, such as ``tempo``. In this
case, :meth:`~re.Pattern.search` will return a :ref:`match object <match-objects>`, so you
should store the result in a variable for later use. :: | trusted_official_docs | CPython Docs | >>> p.search("") >>> print(p.search("")) None
Now, let's try it on a string that it should match, such as ``tempo``. In this
case, :meth:`~re.Pattern.search` will return a :ref:`match object <match-objects>`, so you
should store the result in a variable for later use. :: | >>> p.search("") >>> print(p.search("")) None
Now, let's try it on a string that it should match, such as ``tempo``. In this
case, :meth:`~re.Pattern.search` will return a :ref:`match object <match-objects>`, so you
should store the result in a variable for later use. :: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
22b71148-0c3e-4541-a184-8eb19d414fb5 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,577 | supabase-export-v2 | 4b748257f71b5ad6 | ``.*[.]([^b]..|.[^a].|..[^t])$``
The expression gets messier when you try to patch up the first solution by
requiring one of the following cases to match: the first character of the
extension isn't ``b``; the second character isn't ``a``; or the third character
isn't ``t``. This accepts ``foo.bar`` and rejects ``autoex... | trusted_official_docs | CPython Docs | ``.*[.]([^b]..|.[^a].|..[^t])$``
The expression gets messier when you try to patch up the first solution by
requiring one of the following cases to match: the first character of the
extension isn't ``b``; the second character isn't ``a``; or the third character
isn't ``t``. This accepts ``foo.bar`` and rejects ``autoex... | ``.*[.]([^b]..|.[^a].|..[^t])$``
The expression gets messier when you try to patch up the first solution by
requiring one of the following cases to match: the first character of the
extension isn't ``b``; the second character isn't ``a``; or the third character
isn't ``t``. This accepts ``foo.bar`` and rejects ``autoex... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
23a4ce1d-91c2-4fc2-89ac-bc2a19fd6605 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,549 | supabase-export-v2 | a489f0c5c4a4d9d4 | new metacharacter, for example, old expressions would be assuming that ``&`` was a regular character and wouldn't have escaped it by writing ``\&`` or ``[&]``.
The solution chosen by the Perl developers was to use ``(?...)`` as the
extension syntax. ``?`` immediately after a parenthesis was a syntax error
because the `... | trusted_official_docs | CPython Docs | new metacharacter, for example, old expressions would be assuming that ``&`` was a regular character and wouldn't have escaped it by writing ``\&`` or ``[&]``.
The solution chosen by the Perl developers was to use ``(?...)`` as the
extension syntax. ``?`` immediately after a parenthesis was a syntax error
because the `... | new metacharacter, for example, old expressions would be assuming that ``&`` was a regular character and wouldn't have escaped it by writing ``\&`` or ``[&]``.
The solution chosen by the Perl developers was to use ``(?...)`` as the
extension syntax. ``?`` immediately after a parenthesis was a syntax error
because the `... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
24ccd6f5-761b-46fe-96db-cdcb33c16a96 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,568 | supabase-export-v2 | 3b564aa103163fb5 | the contained expression has been tried, the matching engine doesn't advance at all; the rest of the pattern is tried right where the assertion started.
``(?!...)``
Negative lookahead assertion. This is the opposite of the positive assertion;
it succeeds if the contained expression *doesn't* match at the current posi... | trusted_official_docs | CPython Docs | the contained expression has been tried, the matching engine doesn't advance at all; the rest of the pattern is tried right where the assertion started.
``(?!...)``
Negative lookahead assertion. This is the opposite of the positive assertion;
it succeeds if the contained expression *doesn't* match at the current posi... | the contained expression has been tried, the matching engine doesn't advance at all; the rest of the pattern is tried right where the assertion started.
``(?!...)``
Negative lookahead assertion. This is the opposite of the positive assertion;
it succeeds if the contained expression *doesn't* match at the current posi... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2637af40-81c2-426f-b572-080226ccaa99 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,640 | supabase-export-v2 | 3ae1b44d85a46eb4 | >>> print(re.prefixmatch('<.*?>', s).group()) <html>
(Note that parsing HTML or XML with regular expressions is painful. Quick-and-dirty patterns will handle common cases, but HTML and XML have special
cases that will break the obvious regular expression; by the time you've written
a regular expression that handles all... | trusted_official_docs | CPython Docs | >>> print(re.prefixmatch('<.*?>', s).group()) <html>
(Note that parsing HTML or XML with regular expressions is painful. Quick-and-dirty patterns will handle common cases, but HTML and XML have special
cases that will break the obvious regular expression; by the time you've written
a regular expression that handles all... | >>> print(re.prefixmatch('<.*?>', s).group()) <html>
(Note that parsing HTML or XML with regular expressions is painful. Quick-and-dirty patterns will handle common cases, but HTML and XML have special
cases that will break the obvious regular expression; by the time you've written
a regular expression that handles all... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
27f6fe20-1afe-490d-9085-88e49016fd2a | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,503 | supabase-export-v2 | 11e49b2e83dbf6a7 | More pattern power ==================
So far we've only covered a part of the features of regular expressions. In
this section, we'll cover some new metacharacters, and how to use groups to
retrieve portions of the text that was matched. | trusted_official_docs | CPython Docs | More pattern power ==================
So far we've only covered a part of the features of regular expressions. In
this section, we'll cover some new metacharacters, and how to use groups to
retrieve portions of the text that was matched. | More pattern power ==================
So far we've only covered a part of the features of regular expressions. In
this section, we'll cover some new metacharacters, and how to use groups to
retrieve portions of the text that was matched. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
28e1f38e-5ef3-478c-b33b-ba31a91e4041 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,498 | supabase-export-v2 | b355e9d21ed657b7 | For example, here's a RE that uses :const:`re.VERBOSE`; see how much easier it is to read? ::
charref = re.compile(r"""
&[#] # Start of a numeric entity reference
(
0[0-7]+ # Octal form
| [0-9]+ # Decimal form
| x[0-9a-fA-F]+ # Hexadecimal form
)
; # Trailing semicolon
""", re.VERBOSE) | trusted_official_docs | CPython Docs | For example, here's a RE that uses :const:`re.VERBOSE`; see how much easier it is to read? ::
charref = re.compile(r"""
&[#] # Start of a numeric entity reference
(
0[0-7]+ # Octal form
| [0-9]+ # Decimal form
| x[0-9a-fA-F]+ # Hexadecimal form
)
; # Trailing semicolon
""", re.VERBOSE) | For example, here's a RE that uses :const:`re.VERBOSE`; see how much easier it is to read? ::
charref = re.compile(r"""
&[#] # Start of a numeric entity reference
(
0[0-7]+ # Octal form
| [0-9]+ # Decimal form
| x[0-9a-fA-F]+ # Hexadecimal form
)
; # Trailing semicolon
""", re.VERBOSE) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2c02195c-bca6-470e-84d3-92b0aaf042b7 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,595 | supabase-export-v2 | fb481df4fe5add71 | 'and', 'sweet', 'of', 'split', ''] >>> p.split('This is a test, short and sweet, of split().', 3) ['This', 'is', 'a', 'test, short and sweet, of split().']
Sometimes you're not only interested in what the text between delimiters is, but
also need to know what the delimiter was. If capturing parentheses are used in
the ... | trusted_official_docs | CPython Docs | 'and', 'sweet', 'of', 'split', ''] >>> p.split('This is a test, short and sweet, of split().', 3) ['This', 'is', 'a', 'test, short and sweet, of split().']
Sometimes you're not only interested in what the text between delimiters is, but
also need to know what the delimiter was. If capturing parentheses are used in
the ... | 'and', 'sweet', 'of', 'split', ''] >>> p.split('This is a test, short and sweet, of split().', 3) ['This', 'is', 'a', 'test, short and sweet, of split().']
Sometimes you're not only interested in what the text between delimiters is, but
also need to know what the delimiter was. If capturing parentheses are used in
the ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2c306e9f-2a76-41b0-bffe-5d484985fe10 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,470 | supabase-export-v2 | 24d36b09eeafe1e9 | the entire list before it can be returned as the result. The :meth:`~re.Pattern.finditer` method returns a sequence of :ref:`match object <match-objects>` instances as an :term:`iterator`::
>>> iterator = p.finditer('12 drummers drumming, 11 ... 10 ...')
>>> iterator #doctest: +ELLIPSIS
<callable_iterator object at 0... | trusted_official_docs | CPython Docs | the entire list before it can be returned as the result. The :meth:`~re.Pattern.finditer` method returns a sequence of :ref:`match object <match-objects>` instances as an :term:`iterator`::
>>> iterator = p.finditer('12 drummers drumming, 11 ... 10 ...')
>>> iterator #doctest: +ELLIPSIS
<callable_iterator object at 0... | the entire list before it can be returned as the result. The :meth:`~re.Pattern.finditer` method returns a sequence of :ref:`match object <match-objects>` instances as an :term:`iterator`::
>>> iterator = p.finditer('12 drummers drumming, 11 ... 10 ...')
>>> iterator #doctest: +ELLIPSIS
<callable_iterator object at 0... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2f10b2ac-fb95-40ac-859d-c44b127a1c8c | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,546 | supabase-export-v2 | 161048ce437ab154 | there are few text formats which repeat data in this way --- but you'll soon find out that they're *very* useful when performing string substitutions.
Non-capturing and named groups
------------------------------ | trusted_official_docs | CPython Docs | there are few text formats which repeat data in this way --- but you'll soon find out that they're *very* useful when performing string substitutions.
Non-capturing and named groups
------------------------------ | there are few text formats which repeat data in this way --- but you'll soon find out that they're *very* useful when performing string substitutions.
Non-capturing and named groups
------------------------------ | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2f2d365e-8210-4030-ae6a-5e1a2acdc339 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,522 | supabase-export-v2 | 6e1bb04e0a711938 | The following example matches ``class`` only when it's a complete word; it won't match when it's contained inside another word. ::
>>> p = re.compile(r'\bclass\b')
>>> print(p.search('no class at all'))
<re.Match object; span=(3, 8), match='class'>
>>> print(p.search('the declassified algorithm'))
None
>>> print(p... | trusted_official_docs | CPython Docs | The following example matches ``class`` only when it's a complete word; it won't match when it's contained inside another word. ::
>>> p = re.compile(r'\bclass\b')
>>> print(p.search('no class at all'))
<re.Match object; span=(3, 8), match='class'>
>>> print(p.search('the declassified algorithm'))
None
>>> print(p... | The following example matches ``class`` only when it's a complete word; it won't match when it's contained inside another word. ::
>>> p = re.compile(r'\bclass\b')
>>> print(p.search('no class at all'))
<re.Match object; span=(3, 8), match='class'>
>>> print(p.search('the declassified algorithm'))
None
>>> print(p... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
308eb475-6124-48de-a86a-0e15adf0e3da | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,611 | supabase-export-v2 | 7fe7c0fbfb395a1c | with the substring matched by the corresponding group in the RE. This lets you incorporate portions of the original text in the resulting replacement string.
This example matches the word ``section`` followed by a string enclosed in
``{``, ``}``, and changes ``section`` to ``subsection``:: | trusted_official_docs | CPython Docs | with the substring matched by the corresponding group in the RE. This lets you incorporate portions of the original text in the resulting replacement string.
This example matches the word ``section`` followed by a string enclosed in
``{``, ``}``, and changes ``section`` to ``subsection``:: | with the substring matched by the corresponding group in the RE. This lets you incorporate portions of the original text in the resulting replacement string.
This example matches the word ``section`` followed by a string enclosed in
``{``, ``}``, and changes ``section`` to ``subsection``:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3287fdd1-6450-4cc0-913b-dc4a095e63e6 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,497 | supabase-export-v2 | da74782977e19a44 | that will be ignored by the engine; comments are marked by a ``'#'`` that's neither in a character class nor preceded by an unescaped backslash.
For example, here's a RE that uses :const:`re.VERBOSE`; see how much easier it
is to read? :: | trusted_official_docs | CPython Docs | that will be ignored by the engine; comments are marked by a ``'#'`` that's neither in a character class nor preceded by an unescaped backslash.
For example, here's a RE that uses :const:`re.VERBOSE`; see how much easier it
is to read? :: | that will be ignored by the engine; comments are marked by a ``'#'`` that's neither in a character class nor preceded by an unescaped backslash.
For example, here's a RE that uses :const:`re.VERBOSE`; see how much easier it
is to read? :: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
334a437d-7218-47d8-a643-9d288428a979 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,495 | supabase-export-v2 | 4fe73ceb59b6593b | ``\B``, ``\s`` and ``\S`` perform ASCII-only matching instead of full Unicode matching. This is only meaningful for Unicode patterns, and is ignored for byte patterns.
.. data:: X
VERBOSE
:noindex: | trusted_official_docs | CPython Docs | ``\B``, ``\s`` and ``\S`` perform ASCII-only matching instead of full Unicode matching. This is only meaningful for Unicode patterns, and is ignored for byte patterns.
.. data:: X
VERBOSE
:noindex: | ``\B``, ``\s`` and ``\S`` perform ASCII-only matching instead of full Unicode matching. This is only meaningful for Unicode patterns, and is ignored for byte patterns.
.. data:: X
VERBOSE
:noindex: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3710f46d-35db-4f9a-8771-e778de0f2d2c | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,646 | supabase-export-v2 | 07bdc4304e522643 | a colon (?P<value>.*?) # The header's value -- *? used to # lose the following trailing whitespace \s*$ # Trailing whitespace to end-of-line """, re.VERBOSE)
This is far more readable than:: | trusted_official_docs | CPython Docs | a colon (?P<value>.*?) # The header's value -- *? used to # lose the following trailing whitespace \s*$ # Trailing whitespace to end-of-line """, re.VERBOSE)
This is far more readable than:: | a colon (?P<value>.*?) # The header's value -- *? used to # lose the following trailing whitespace \s*$ # Trailing whitespace to end-of-line """, re.VERBOSE)
This is far more readable than:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
38462c36-09cd-42bb-9fa3-205b068844b1 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,528 | supabase-export-v2 | 929c19bffabd8532 | Grouping --------
Frequently you need to obtain more information than just whether the RE matched
or not. Regular expressions are often used to dissect strings by writing a RE
divided into several subgroups which match different components of interest. For example, an RFC-822 header line is divided into a header name a... | trusted_official_docs | CPython Docs | Grouping --------
Frequently you need to obtain more information than just whether the RE matched
or not. Regular expressions are often used to dissect strings by writing a RE
divided into several subgroups which match different components of interest. For example, an RFC-822 header line is divided into a header name a... | Grouping --------
Frequently you need to obtain more information than just whether the RE matched
or not. Regular expressions are often used to dissect strings by writing a RE
divided into several subgroups which match different components of interest. For example, an RFC-822 header line is divided into a header name a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3869e301-04ab-44bb-998b-539fead1476d | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,450 | supabase-export-v2 | 0e25653c0294b16a | | +------------------+-----------------------------------------------+ | ``finditer()`` | Find all substrings where the RE matches, and | | | return them as an :term:`iterator`. | +------------------+-----------------------------------------------+
:meth:`~re.Pattern.search` and :meth:`~re.Pattern.prefixmatch` return `... | trusted_official_docs | CPython Docs | | +------------------+-----------------------------------------------+ | ``finditer()`` | Find all substrings where the RE matches, and | | | return them as an :term:`iterator`. | +------------------+-----------------------------------------------+
:meth:`~re.Pattern.search` and :meth:`~re.Pattern.prefixmatch` return `... | | +------------------+-----------------------------------------------+ | ``finditer()`` | Find all substrings where the RE matches, and | | | return them as an :term:`iterator`. | +------------------+-----------------------------------------------+
:meth:`~re.Pattern.search` and :meth:`~re.Pattern.prefixmatch` return `... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3a54e6a6-fbd7-4da0-a71c-f64285dd7ac0 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,616 | supabase-export-v2 | e1585e89b964d304 | function is passed a :ref:`match object <match-objects>` argument for the match and can use this information to compute the desired replacement string and return it.
In the following example, the replacement function translates decimals into
hexadecimal:: | trusted_official_docs | CPython Docs | function is passed a :ref:`match object <match-objects>` argument for the match and can use this information to compute the desired replacement string and return it.
In the following example, the replacement function translates decimals into
hexadecimal:: | function is passed a :ref:`match object <match-objects>` argument for the match and can use this information to compute the desired replacement string and return it.
In the following example, the replacement function translates decimals into
hexadecimal:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3a685555-4200-4ff9-9c47-057b614fed98 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,481 | supabase-export-v2 | 163913d164cb7cd7 | | +---------------------------------+--------------------------------------------+ | :const:`DOTALL`, :const:`S` | Make ``.`` match any character, including | | | newlines. | +---------------------------------+--------------------------------------------+ | :const:`IGNORECASE`, :const:`I` | Do case-insensitive matches.... | trusted_official_docs | CPython Docs | | +---------------------------------+--------------------------------------------+ | :const:`DOTALL`, :const:`S` | Make ``.`` match any character, including | | | newlines. | +---------------------------------+--------------------------------------------+ | :const:`IGNORECASE`, :const:`I` | Do case-insensitive matches.... | | +---------------------------------+--------------------------------------------+ | :const:`DOTALL`, :const:`S` | Make ``.`` match any character, including | | | newlines. | +---------------------------------+--------------------------------------------+ | :const:`IGNORECASE`, :const:`I` | Do case-insensitive matches.... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3bac8a4f-c04f-4147-b5dc-022ca6d60f78 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,624 | supabase-export-v2 | b8f6493bf917457b | would have to be ``\bword\b``, in order to require that ``word`` have a word boundary on either side. This takes the job beyond :meth:`!replace`'s abilities.)
Another common task is deleting every occurrence of a single character from a
string or replacing it with another single character. You might do this with
someth... | trusted_official_docs | CPython Docs | would have to be ``\bword\b``, in order to require that ``word`` have a word boundary on either side. This takes the job beyond :meth:`!replace`'s abilities.)
Another common task is deleting every occurrence of a single character from a
string or replacing it with another single character. You might do this with
someth... | would have to be ``\bword\b``, in order to require that ``word`` have a word boundary on either side. This takes the job beyond :meth:`!replace`'s abilities.)
Another common task is deleting every occurrence of a single character from a
string or replacing it with another single character. You might do this with
someth... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3c074573-96a0-4a32-99ba-dd44e01e3655 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,526 | supabase-export-v2 | 709e03f9921a7fce | Second, inside a character class, where there's no use for this assertion, ``\b`` represents the backspace character, for compatibility with Python's string literals.
``\B``
Another zero-width assertion, this is the opposite of ``\b``, only matching when
the current position is not at a word boundary. | trusted_official_docs | CPython Docs | Second, inside a character class, where there's no use for this assertion, ``\b`` represents the backspace character, for compatibility with Python's string literals.
``\B``
Another zero-width assertion, this is the opposite of ``\b``, only matching when
the current position is not at a word boundary. | Second, inside a character class, where there's no use for this assertion, ``\b`` represents the backspace character, for compatibility with Python's string literals.
``\B``
Another zero-width assertion, this is the opposite of ``\b``, only matching when
the current position is not at a word boundary. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3c097ef9-253c-46f1-a4de-82a50f59734a | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,482 | supabase-export-v2 | bc0ce24abe38f431 | ``$``. | +---------------------------------+--------------------------------------------+ | :const:`VERBOSE`, :const:`X` | Enable verbose REs, which can be organized | | (for 'extended') | more cleanly and understandably. | +---------------------------------+--------------------------------------------+
.. data:: I
IG... | trusted_official_docs | CPython Docs | ``$``. | +---------------------------------+--------------------------------------------+ | :const:`VERBOSE`, :const:`X` | Enable verbose REs, which can be organized | | (for 'extended') | more cleanly and understandably. | +---------------------------------+--------------------------------------------+
.. data:: I
IG... | ``$``. | +---------------------------------+--------------------------------------------+ | :const:`VERBOSE`, :const:`X` | Enable verbose REs, which can be organized | | (for 'extended') | more cleanly and understandably. | +---------------------------------+--------------------------------------------+
.. data:: I
IG... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3cf28ccb-87c2-4500-b3ae-a11354ca6f18 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,484 | supabase-export-v2 | 6c8fb7ce51a8d474 | latter is matched only in Unicode mode). This lowercasing doesn't take the current locale into account; it will if you also set the :const:`LOCALE` flag.
.. data:: L
LOCALE
:noindex: | trusted_official_docs | CPython Docs | latter is matched only in Unicode mode). This lowercasing doesn't take the current locale into account; it will if you also set the :const:`LOCALE` flag.
.. data:: L
LOCALE
:noindex: | latter is matched only in Unicode mode). This lowercasing doesn't take the current locale into account; it will if you also set the :const:`LOCALE` flag.
.. data:: L
LOCALE
:noindex: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3d191a57-fc55-4fc0-9264-d89fe6cdc05c | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,592 | supabase-export-v2 | 34841dd7a238ed91 | .. method:: .split(string [, maxsplit=0]) :noindex:
Split *string* by the matches of the regular expression. If capturing
parentheses are used in the RE, then their contents will also be returned as
part of the resulting list. If *maxsplit* is nonzero, at most *maxsplit* splits
are performed. | trusted_official_docs | CPython Docs | .. method:: .split(string [, maxsplit=0]) :noindex:
Split *string* by the matches of the regular expression. If capturing
parentheses are used in the RE, then their contents will also be returned as
part of the resulting list. If *maxsplit* is nonzero, at most *maxsplit* splits
are performed. | .. method:: .split(string [, maxsplit=0]) :noindex:
Split *string* by the matches of the regular expression. If capturing
parentheses are used in the RE, then their contents will also be returned as
part of the resulting list. If *maxsplit* is nonzero, at most *maxsplit* splits
are performed. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3f728ea6-c673-48ea-88f1-151d029c83c9 | CPython Docs | file://datasets/cpython/Doc/howto/regex.rst | unknown | a0410288-0e34-49d0-91b0-b1fbbd428672 | 57,557 | supabase-export-v2 | 8203a7a78212d15f | or strings that contain the desired group's name. Named groups are still given numbers, so you can retrieve information about a group in two ways::
>>> p = re.compile(r'(?P<word>\b\w+\b)')
>>> m = p.search( '(((( Lots of punctuation )))' )
>>> m.group('word')
'Lots'
>>> m.group(1)
'Lots' | trusted_official_docs | CPython Docs | or strings that contain the desired group's name. Named groups are still given numbers, so you can retrieve information about a group in two ways::
>>> p = re.compile(r'(?P<word>\b\w+\b)')
>>> m = p.search( '(((( Lots of punctuation )))' )
>>> m.group('word')
'Lots'
>>> m.group(1)
'Lots' | or strings that contain the desired group's name. Named groups are still given numbers, so you can retrieve information about a group in two ways::
>>> p = re.compile(r'(?P<word>\b\w+\b)')
>>> m = p.search( '(((( Lots of punctuation )))' )
>>> m.group('word')
'Lots'
>>> m.group(1)
'Lots' | python, official-docs, cpython, P0 | Local_Trusted_Corpus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.