Notice: While JavaScript is not essential for this website, your interaction with the content will be limited. Please turn JavaScript on for the full experience.
...structure will be changed to contain a list of slots, similarly to PEP 384's PyType_Spec for types. To keep binary compatibility, and avoid needing to introduce a new structure (which would introduce additional supporting functions and per-module storage), the currently unused m_reload pointer of PyModuleDef will be changed to hold the slots. The structures are defined as: typedef struct { int slot; void *value; } PyModuleDef_Slot; typedef struct PyModuleDef { PyModuleDef_Base m_ba...
...definitions of PyModule_AddStringConstant and PyModule_AddObject if the Python version is less than 2.0, which provides compatibility with PyXML on Python 1.5.2. If the platform has a bogus definition for LONG_BIT (the number of bits in a long), an error will be reported at compile time. Fix bugs in _PyTuple_Resize() which caused hard-to-interpret garbage collection crashes and possibly other, unreported crashes. Fixed a memory leak in _PyUnicode_Fini(). Build issues ...
...structure is 8 bytes long, and a 'dictionary' struct is 60 bytes, and an object pointer is 4 bytes. Then an X structure is 12 bytes (an object structure followed by a __dict__ pointer), and a Y structure is 64 bytes (a dictionary structure followed by a __dict__ pointer). The Z structure has the same layout as the Y structure in this example. Each type object (X, Y and Z) has a "__dict__ offset" which is used to find the __dict__ pointer. Thus, the recipe for looking up an instance variable i...
...structure could cause a segfault in the garbage collector, due to interaction with the "trashcan" code; access to the current frame during destruction of a local variable could access a pointer to freed memory. SF #457466: popenx() argument mangling hangs python (win9x only). Under certain circumstances, using any of the popen calls on win9x would cause python to hang. Library The xml.sax.expatreader.ExpatParser class will no longer create circular references by using itself as the l...
...Definitions for built-in types Non-definition of matrix power Rejected alternatives to adding a new operator Discussions of this PEP References Copyright Abstract This PEP proposes a new binary operator to be used for matrix multiplication, called @. (Mnemonic: @ is * for mATrices.) Specification A new binary operator is added to the Python language, together with the corresponding in-place version: Op Precedence/associativity Methods @ Same as * __matmul__, __rmatmul__ @= n/a...
...structs may either line up under the first non-whitespace character of the last line of list, as in: my_list = [ 1, 2, 3, 4, 5, 6, ] result = some_function_that_takes_arguments( 'a', 'b', 'c', 'd', 'e', 'f', ) or it may be lined up under the first character of the line that starts the multiline construct, as in: my_list = [ 1, 2, 3, 4, 5, 6, ] result = some_function_that_takes_arguments( 'a', 'b', 'c', 'd', 'e', 'f', ) Tabs or Spaces? Spaces are the ...
...struction mirrors the syntax of construction. This is already the case in virtually any Python construct, be assignment targets, function definitions or iterable unpacking. In all these cases, we find that the syntax for sending and that for receiving 'data' are virtually identical. Assignment targets such as variables, attributes and subscripts: foo.bar[2] = foo.bar[3]; Function definitions: a function defined with def foo(x, y, z=6) is called as, e.g., foo(123, y=45), where the actual argum...
...struct provisional field tp_example removed from the PyTypeObject struct Projects that are supporting the rolling release stream and require a rebuild to restore binary compatibility should add the following metadata to their updated release: Python-Requires: >= "3.9.0b6"; python_version == "3.9" and full_python_version != "3.9.0a5" (Remainder as per 3.9.0a1 announcement, with updates for implemented changes and the next expected release being 3.9.0b6) Example announcement text for 3.9....
...struct type as struct_pwent; this has been renamed to struct_passwd. (The old name is still supported for backwards compatibility.) The xml.parsers.expat module now provides Expat 1.95.7. socket.IPPROTO_IPV6 was added. readline.clear_history was added. select.select() now accepts sequences for its first three arguments. cStringIO now supports the f.closed attribute. The signal module now exposes SIGRTMIN and SIGRTMAX (if available). curses module now supports use_default_colors(). [patch #7391...
...structs with the approval of the release manager, performance improvements can be incorporated for existing APIs and syntactic constructs The intent of this change in policy is to allow usability improvements for new (and existing!) language features to be delivered in a more timely fashion, rather than requiring users to incur the inherent delay and costs of waiting for and then upgrading to the next feature release series. It is also designed such that the approval to add a feature to the nex...
...struct to indexing operations: >>> val = x[1, 2, a=3, b=4] # getitem >>> x[1, 2, a=3, b=4] = val # setitem >>> del x[1, 2, a=3, b=4] # delitem and would also provide appropriate semantics. Single- and double-star unpacking of arguments is also provided: >>> val = x[*(1, 2), **{a=3, b=4}] # Equivalent to above. This PEP is a successor to PEP 472, which was rejected due to lack of interest in 2019. Since then there's been renewed interest in the featur...
...structors for the other builtin types -- called without argument they all return the false value of that type. (SF patch #724135) In support of PEP 269 (making the pgen parser generator accessible from Python), some changes to the pgen code structure were made; a few files that used to be linked only with pgen are now linked with Python itself. The repr() of a weakref object now shows the __name__ attribute of the referenced object, if it has one. super() no longer ignores data descriptors, exc...
...definitions to the CPython C API. Motivation While the precise semantics of the locals() builtin are nominally undefined, in practice, many Python programs depend on it behaving exactly as it behaves in CPython (at least when no tracing functions are installed). Other implementations such as PyPy are currently replicating that behaviour, up to and including replication of local variable mutation bugs that can arise when a trace hook is installed [1]. While this PEP considers CPython's current ...