Servicios en tiempo de ejecución de Python¶
Los módulos descritos en este capítulo proporcionan una amplia gama de servicios relacionados con el intérprete de Python y su interacción con su entorno. Esta es una descripción general:
sys
— Parámetros y funciones específicos del sistemaabiflags
addaudithook()
argv
audit()
base_exec_prefix
base_prefix
byteorder
builtin_module_names
call_tracing()
copyright
_clear_type_cache()
_current_frames()
_current_exceptions()
breakpointhook()
_debugmallocstats()
dllhandle
displayhook()
dont_write_bytecode
_emscripten_info
pycache_prefix
excepthook()
__breakpointhook__
__displayhook__
__excepthook__
__unraisablehook__
exception()
exc_info()
exec_prefix
executable
exit()
flags
flags.debug
flags.inspect
flags.interactive
flags.isolated
flags.optimize
flags.dont_write_bytecode
flags.no_user_site
flags.no_site
flags.ignore_environment
flags.verbose
flags.bytes_warning
flags.quiet
flags.hash_randomization
flags.dev_mode
flags.utf8_mode
flags.safe_path
flags.int_max_str_digits
flags.warn_default_encoding
float_info
float_repr_style
getallocatedblocks()
getunicodeinternedsize()
getandroidapilevel()
getdefaultencoding()
getdlopenflags()
getfilesystemencoding()
getfilesystemencodeerrors()
get_int_max_str_digits()
getrefcount()
getrecursionlimit()
getsizeof()
getswitchinterval()
_getframe()
_getframemodulename()
getprofile()
gettrace()
getwindowsversion()
get_asyncgen_hooks()
get_coroutine_origin_tracking_depth()
hash_info
hexversion
implementation
int_info
__interactivehook__
intern()
is_finalizing()
last_exc
last_type
last_value
last_traceback
maxsize
maxunicode
meta_path
modules
orig_argv
path
path_hooks
path_importer_cache
platform
platlibdir
prefix
ps1
ps2
setdlopenflags()
set_int_max_str_digits()
setprofile()
setrecursionlimit()
setswitchinterval()
settrace()
set_asyncgen_hooks()
set_coroutine_origin_tracking_depth()
activate_stack_trampoline()
deactivate_stack_trampoline()
is_stack_trampoline_active()
_enablelegacywindowsfsencoding()
stdin
stdout
stderr
__stdin__
__stdout__
__stderr__
stdlib_module_names
thread_info
tracebacklimit
unraisablehook()
version
api_version
version_info
warnoptions
winver
_xoptions
sys.monitoring
— Monitoreo de eventos de ejecuciónsysconfig
— Proporciona acceso a la información de configuración de Pythonbuiltins
— Objetos incorporados__main__
— Entorno de código de nivel máximowarnings
— Control de advertenciasdataclasses
— Clases de datoscontextlib
— Utilidades para declaraciones de contextowith
- Utilidades
- Ejemplos y recetas
- Gestores de contexto de uso único, reutilizables y reentrantes
abc
— Clases de Base Abstractaatexit
— Gestores de Salidatraceback
— Imprimir o recuperar un seguimiento de pilaprint_tb()
print_exception()
print_exc()
print_last()
print_stack()
extract_tb()
extract_stack()
format_list()
format_exception_only()
format_exception()
format_exc()
format_tb()
format_stack()
clear_frames()
walk_stack()
walk_tb()
- Objetos
TracebackException
TracebackException
TracebackException.__cause__
TracebackException.__context__
TracebackException.exceptions
TracebackException.__suppress_context__
TracebackException.__notes__
TracebackException.stack
TracebackException.exc_type
TracebackException.filename
TracebackException.lineno
TracebackException.end_lineno
TracebackException.text
TracebackException.offset
TracebackException.end_offset
TracebackException.msg
TracebackException.from_exception()
TracebackException.print()
TracebackException.format()
TracebackException.format_exception_only()
- Objetos
StackSummary
- Objetos
FrameSummary
- Ejemplos de seguimiento de pila
__future__
— Definiciones de declaraciones futurasgc
— Interfaz del recolector de basuraenable()
disable()
isenabled()
collect()
set_debug()
get_debug()
get_objects()
get_stats()
set_threshold()
get_count()
get_threshold()
get_referrers()
get_referents()
is_tracked()
is_finalized()
freeze()
unfreeze()
get_freeze_count()
garbage
callbacks
DEBUG_STATS
DEBUG_COLLECTABLE
DEBUG_UNCOLLECTABLE
DEBUG_SAVEALL
DEBUG_LEAK
inspect
— Inspeccionar objetos vivos- Tipos y miembros
getmembers()
getmembers_static()
getmodulename()
ismodule()
isclass()
ismethod()
isfunction()
isgeneratorfunction()
isgenerator()
iscoroutinefunction()
markcoroutinefunction()
iscoroutine()
isawaitable()
isasyncgenfunction()
isasyncgen()
istraceback()
isframe()
iscode()
isbuiltin()
ismethodwrapper()
isroutine()
isabstract()
ismethoddescriptor()
isdatadescriptor()
isgetsetdescriptor()
ismemberdescriptor()
- Recuperar el código fuente
- Introspección de los invocables con el objeto Signature
- Clases y funciones
- La pila del interprete
- Obteniendo atributos estáticamente
- Current State of Generators, Coroutines, and Asynchronous Generators
- Objetos de código Bit Flags
- Buffer flags
BufferFlags
BufferFlags.SIMPLE
BufferFlags.WRITABLE
BufferFlags.FORMAT
BufferFlags.ND
BufferFlags.STRIDES
BufferFlags.C_CONTIGUOUS
BufferFlags.F_CONTIGUOUS
BufferFlags.ANY_CONTIGUOUS
BufferFlags.INDIRECT
BufferFlags.CONTIG
BufferFlags.CONTIG_RO
BufferFlags.STRIDED
BufferFlags.STRIDED_RO
BufferFlags.RECORDS
BufferFlags.RECORDS_RO
BufferFlags.FULL
BufferFlags.FULL_RO
BufferFlags.READ
BufferFlags.WRITE
- Interfaz de la línea de comando
- Tipos y miembros
site
— Enlace (hook) de configuración específico del sitio