跳转到主要内容

章节Python 官方文档

C Api

80 页更新于 2 天前

开始阅读

本章内容80

  1. 01 Abstract Objects Layer The functions in this chapter interact with Python objects regardless of their type, or with wide classes o... 2 天前
  2. 02 Allocating objects on the heap Initialize a newly allocated object op with its type and initial reference. Returns the initialized object.... 2 天前
  3. 03 API and ABI Versioning Build-time version constants CPython exposes its version number in the following macros. Note that these co... 2 天前
  4. 04 Parsing arguments and building values These functions are useful when creating your own extension functions and methods. Additional information a... 2 天前
  5. 05 Boolean Objects Booleans in Python are implemented as a subclass of integers. There are only two booleans, Py_False and P... 2 天前
  6. 06 buffer single: buffer protocol single: buffer interface; (see buffer protocol) single: buffer object; (see buffer ... 2 天前
  7. 07 Byte Array Objects pair: object; bytearray This subtype of PyObject represents a Python bytearray object. The internal buffer... 2 天前
  8. 08 Bytes Objects These functions raise TypeError when expecting a bytes parameter and called with a non-bytes parameter. Th... 2 天前
  9. 09 Call Protocol CPython supports two different calling protocols: tp_call and vectorcall. The tp_call Protocol Instances of... 2 天前
  10. 10 Capsules pair: object; Capsule Refer to using-capsules for more information on using these objects. 3.1 This subtyp... 2 天前
  11. 11 Cell Objects "Cell" objects are used to implement variables referenced by multiple scopes. For each such variable, a cel... 2 天前
  12. 12 code object; code, code object Code Objects Code objects are a low-level detail of the CPython implementation. E... 2 天前
  13. 13 Codec registry and support functions Register a new codec search function. As a side effect, this tries to load the !encodings package, if not ... 2 天前
  14. 14 Complex Number Objects pair: object; complex number This subtype of PyObject represents a Python complex number object. The compl... 2 天前
  15. 15 Concrete Objects Layer The functions in this chapter are specific to certain Python object types. Passing them an object of the wr... 2 天前
  16. 16 Context Variables Objects 3.7.1 [!NOTE] In Python 3.7.1 the signatures of all context variables C APIs were changed to use PyObject ... 2 天前
  17. 17 String conversion and formatting Functions for number conversion and formatted string output. Output not more than size bytes to str accordi... 2 天前
  18. 18 Coroutine Objects 3.5 Coroutine objects are what functions declared with an async keyword return. The C structure used for c... 2 天前
  19. 19 Curses C API curses exposes a small C interface for extension modules. Consumers must include the header file py_curses... 2 天前
  20. 20 DateTime Objects Various date and time objects are supplied by the datetime module. Before using any of these functions, th... 2 天前
  21. 21 Descriptor Objects "Descriptors" are objects that describe some attribute of an object. They are found in the dictionary of ty... 2 天前
  22. 22 Dictionary objects pair: object; dictionary This subtype of PyObject represents a Python dictionary object. This instance of ... 2 天前
  23. 23 Exception Handling The functions described in this chapter will let you handle and raise Python exceptions. It is important to... 2 天前
  24. 24 Defining extension modules A C extension for CPython is a shared library (for example, a .so file on Linux, .pyd DLL on Windows), wh... 2 天前
  25. 25 File objects pair: object; file These APIs are a minimal emulation of the Python 2 C API for built-in file objects, whic... 2 天前
  26. 26 Floating-Point Objects pair: object; floating-point This subtype of PyObject represents a Python floating-point object. This inst... 2 天前
  27. 27 Frame objects The C structure of the objects used to describe frame objects. There are no public members in this structur... 2 天前
  28. 28 Function Objects pair: object; function There are a few functions specific to Python functions. The C structure used for fun... 2 天前
  29. 29 Supporting Cyclic Garbage Collection Python's support for detecting and collecting garbage which involves circular references requires support f... 2 天前
  30. 30 Generator Objects Generator objects are what Python uses to implement generator iterators. They are normally created by itera... 2 天前
  31. 31 PyHash API See also the PyTypeObject.tp_hash member and numeric-hash. Hash value type: signed integer. 3.2 Hash valu... 2 天前
  32. 32 Importing Modules single: package variable; __all__ single: __all__ (package variable) single: modules (in module sys) This i... 2 天前
  33. 33 Python/C API reference manual This manual documents the API used by C and C++ programmers who want to write extension modules or embed Py... 2 天前
  34. 34 init orphan Initialization, finalization, and threads This page has been split up into the following: initializa... 2 天前
  35. 35 Python Initialization Configuration PyInitConfig C API 3.14 Python can be initialized with Py_InitializeFromInitConfig. The Py_RunMain functi... 2 天前
  36. 36 Interpreter initialization and finalization See Python Initialization Configuration <init-config> for details on how to configure the interpreter prio... 2 天前
  37. 37 Introduction The Application Programmer's Interface to Python gives C and C++ programmers access to the Python interpret... 2 天前
  38. 38 Iterator Protocol There are two functions specifically for working with iterators. Return non-zero if the object o can be saf... 2 天前
  39. 39 Iterator Objects Python provides two general-purpose iterator objects. The first, a sequence iterator, works with an arbitra... 2 天前
  40. 40 Object Life Cycle This section explains how a type's slots relate to each other throughout the life of an object. It is not i... 2 天前
  41. 41 List Objects pair: object; list This subtype of PyObject represents a Python list object. This instance of PyTypeObjec... 2 天前
  42. 42 Integer Objects pair: object; long integer pair: object; integer All integers are implemented as "long" integer objects of ... 2 天前
  43. 43 Mapping Protocol See also PyObject_GetItem, PyObject_SetItem and PyObject_DelItem. Return 1 if the object provides the m... 2 天前
  44. 44 Data marshalling support These routines allow C code to work with serialized objects using the same data format as the marshal modu... 2 天前
  45. 45 Memory Management Overview Memory management in Python involves a private heap containing all Python objects and data structu... 2 天前
  46. 46 memoryview pair: object; memoryview MemoryView objects A memoryview object exposes the C level buffer interface <buf... 2 天前
  47. 47 Instance Method Objects pair: object; instancemethod An instance method is a wrapper for a PyCFunction and the new way to bind a ... 2 天前
  48. 48 Module Objects pair: object; module single: ModuleType (in module types) This instance of PyTypeObject represents the Pyt... 2 天前
  49. 49 Monitoring C API Added in version 3.13. An extension may need to interact with the event monitoring system. Subscribing to e... 2 天前
  50. 50 The `None` Object pair: object; None Note that the PyTypeObject for None is not directly exposed in the Python/C API. Since... 2 天前
  51. 51 Number Protocol Returns 1 if the object o provides numeric protocols, and false otherwise. This function always succeeds. ... 2 天前
  52. 52 Object Protocol Get a strong reference to a constant. Set an exception and return NULL if constant_id is invalid. constan... 2 天前
  53. 53 Object Implementation Support This chapter describes the functions, types, and macros used when defining new object types. allocation.rst... 2 天前
  54. 54 Support for Perf Maps On supported platforms (Linux and macOS), the runtime can take advantage of perf map files to make Python f... 2 天前
  55. 55 picklebuffer pair: object; PickleBuffer Pickle buffer objects 3.8 A pickle.PickleBuffer object wraps a buffer-providin... 2 天前
  56. 56 Profiling and tracing The Python interpreter provides some low-level support for attaching profiling and execution tracing facili... 2 天前
  57. 57 Expat C API The xml.parsers.expat module exposes selected Expat functions through its expat_CAPI capsule. This allows... 2 天前
  58. 58 Reference Counting The functions and macros in this section are used for managing reference counts of Python objects. Get the ... 2 天前
  59. 59 Reflection 3.13 Use PyEval_GetFrameBuiltins instead. Return a dictionary of the builtins in the current execution fra... 2 天前
  60. 60 Sentinel objects This instance of PyTypeObject represents the Python sentinel type. This is the same object as sentinel. ... 2 天前
  61. 61 Sequence Protocol Return 1 if the object provides the sequence protocol, and 0 otherwise. Note that it returns 1 for Pytho... 2 天前
  62. 62 Set Objects pair: object; set pair: object; frozenset This section details the public API for set and frozenset objec... 2 天前
  63. 63 Slice Objects The type object for slice objects. This is the same as slice in the Python layer. Return true if ob is a s... 2 天前
  64. 64 Definition slots To define module objects <moduleobjects> and classes <creating-heap-types> using the C API, you may use a... 2 天前
  65. 65 C API and ABI Stability Unless documented otherwise, Python's C API is covered by the Backwards Compatibility Policy, 387. Most ch... 2 天前
  66. 66 Common Object Structures There are a large number of structures which are used in the definition of object types for Python. This se... 2 天前
  67. 67 Multiple interpreters in a Python process While in most uses, you will only embed a single Python interpreter, there are cases where you need to crea... 2 天前
  68. 68 Synchronization primitives The C-API provides a basic mutual exclusion lock. A mutual exclusion lock. The !PyMutex should be initiali... 2 天前
  69. 69 Operating System Utilities Return the file system representation for path. If the object is a str or bytes object, then a new stron... 2 天前
  70. 70 Thread states and the global interpreter lock single: global interpreter lock single: interpreter lock single: lock, interpreter Unless on a free-thread... 2 天前
  71. 71 PyTime C API 3.13 The clock C API provides access to system clocks. It is similar to the Python time module. For C API ... 2 天前
  72. 72 Thread-local storage support The Python interpreter provides low-level support for thread-local storage (TLS) which wraps the underlying... 2 天前
  73. 73 Tuple Objects pair: object; tuple This subtype of PyObject represents a Python tuple object. This instance of PyTypeObj... 2 天前
  74. 74 Type Objects pair: object; type The C structure of the objects used to describe built-in types. This is the type object ... 2 天前
  75. 75 Objects for Type Hinting Various built-in types for type hinting are provided. Currently, two types exist -- GenericAlias <types-ge... 2 天前
  76. 76 Type Object Structures Perhaps one of the most important structures of the Python object system is the structure that defines a ne... 2 天前
  77. 77 Unicode Objects and Codecs Unicode Objects Since the implementation of 393 in Python 3.3, Unicode objects internally use a variety of... 2 天前
  78. 78 Utilities The functions in this chapter perform various utility tasks, ranging from helping C code be more portable a... 2 天前
  79. 79 The Very High Level Layer The functions in this chapter will let you execute Python source code given in a file or a buffer, but they... 2 天前
  80. 80 Weak Reference Objects Python supports weak references as first-class objects. There are two specific object types which directly ... 2 天前