Skip to content

Commit

Permalink
Merge branch 'main' into explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Aug 5, 2023
2 parents a403c17 + 5e2746d commit a67d2a8
Show file tree
Hide file tree
Showing 323 changed files with 7,693 additions and 4,224 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,11 @@ Doc/library/token-list.inc generated
Include/internal/pycore_ast.h generated
Include/internal/pycore_ast_state.h generated
Include/internal/pycore_opcode.h generated
Include/internal/pycore_opcode_metadata.h generated
Include/internal/pycore_*_generated.h generated
Include/opcode.h generated
Include/token.h generated
Lib/_opcode_metadata.py generated
Lib/keyword.py generated
Lib/test/levenshtein_examples.json generated
Lib/test/test_stable_abi_ctypes.py generated
Expand Down
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Python/traceback.c @iritkatriel

# Import (including importlib).
**/*import* @brettcannon @ericsnowcurrently @ncoghlan @warsaw
/Python/import.c @kumaraditya303
**/*importlib/resources/* @jaraco @warsaw @FFY00
**/importlib/metadata/* @jaraco @warsaw

Expand Down
38 changes: 28 additions & 10 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,46 @@ labels: "type-bug"
---

<!--
If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not
the right place to seek help. Consider the following options instead:
New to Python? The issue tracker isn't the right place to get help.
Consider instead:
- reading the Python tutorial: https://docs.python.org/3/tutorial/
- posting in the "Users" category on discuss.python.org: https://discuss.python.org/c/users/7
- emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list
- searching our issue tracker (https://github.com/python/cpython/issues) to see if
your problem has already been reported
- posting at https://discuss.python.org/c/users/7
- emailing https://mail.python.org/mailman/listinfo/python-list
-->

# Bug report

A clear and concise description of what the bug is.
Include a minimal, reproducible example (https://stackoverflow.com/help/minimal-reproducible-example), if possible.
## Checklist

<!-- Bugs in third-party projects (e.g. `requests`) do not belong in the CPython issue tracker -->

- [ ] I am confident this is a bug in CPython, not a bug in a third-party project
- [ ] I have searched the CPython issue tracker, and am confident this bug has not been reported before

## A clear and concise description of the bug

<!--
Include a minimal, reproducible example if possible.
(https://stackoverflow.com/help/minimal-reproducible-example)
Put any code blocks inside triple backticks:
```py
your code here
```
-->



# Your environment

<!-- Include as many relevant details as possible about the environment you experienced the bug in -->
<!-- Include all relevant details about the environment you experienced the bug in -->

- CPython versions tested on:
- Operating system and architecture:

<!--
You can freely edit this text. Remove any lines you believe are unnecessary.
You can freely edit this form. Remove any lines you believe are unnecessary.
-->
33 changes: 24 additions & 9 deletions .github/ISSUE_TEMPLATE/crash.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,44 @@ labels: "type-crash"
---

<!--
Use this template for hard crashes of the interpreter, segmentation faults, failed C-level assertions, and similar.
Do not submit this form if you encounter an exception being unexpectedly raised from a Python function.
Most of the time, these should be filed as bugs, rather than crashes.
This form is for hard crashes of the Python interpreter, segmentation faults,
failed C-level assertions, and similar.
Exceptions unexpectedly raised from stdlib Python functions
count as bugs rather than crashes.
The CPython interpreter is itself written in a different programming language, C.
For CPython, a "crash" is when Python itself fails, leading to a traceback in the C stack.
The CPython interpreter is written in a different programming language, C.
A "CPython crash" is when Python itself fails, leading to a traceback in the C stack.
-->

# Crash report

Tell us what happened, ideally including a minimal, reproducible example (https://stackoverflow.com/help/minimal-reproducible-example).
<!--
Tell us what happened. Ideally, include a minimal, reproducible example.
(https://stackoverflow.com/help/minimal-reproducible-example)
Put any code blocks inside triple backticks:
```py
your code here
```
-->



# Error messages

Enter any relevant error message caused by the crash, including a core dump if there is one.
<!-- Enter any error messages caused by the crash, including a core dump if there is one -->



# Your environment

<!-- Include as many relevant details as possible about the environment you experienced the bug in -->
<!-- Include all relevant details about the environment you experienced the crash in -->

- CPython versions tested on:
- Operating system and architecture:

<!--
You can freely edit this text. Remove any lines you believe are unnecessary.
You can freely edit this form. Remove any lines you believe are unnecessary.
-->
38 changes: 30 additions & 8 deletions .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,47 @@ about: Submit a proposal for a new CPython feature or enhancement
labels: "type-feature"
---

<!--
Proposing a new feature for Python?
You'll need to demonstrate widespread support for your idea among the community.
Major feature proposals should generally be discussed at
https://discuss.python.org/c/ideas/6 before opening a GitHub issue.
Wait until it's clear that most people support your idea
before filling in this form.
-->

# Feature or enhancement

(A clear and concise description of your proposal.)
<!-- A clear and concise description of your proposal. -->



# Pitch

(Explain why this feature or enhancement should be implemented and how it would be used.
Add examples, if applicable.)
<!--
Explain why this feature or enhancement should be implemented and how it would be used.
Add examples, if applicable.
Put any code blocks inside triple backticks:
```py
your code here
```
-->



# Previous discussion

<!--
New features to Python should first be discussed elsewhere before creating issues on GitHub,
for example in the "ideas" category (https://discuss.python.org/c/ideas/6) of discuss.python.org,
or the python-ideas mailing list (https://mail.python.org/mailman3/lists/python-ideas.python.org/).
Use this space to post links to the places where you have already discussed this feature proposal:
Use this space to post links to the places
where you have already discussed your feature proposal:
-->



<!--
You can freely edit this text. Remove any lines you believe are unnecessary.
You can freely edit this form. Remove any lines you believe are unnecessary.
-->
19 changes: 11 additions & 8 deletions Doc/c-api/allocation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,34 @@ Allocating Objects on the Heap
length information for a variable-size object.
.. c:function:: TYPE* PyObject_New(TYPE, PyTypeObject *type)
.. c:macro:: PyObject_New(TYPE, typeobj)
Allocate a new Python object using the C structure type *TYPE* and the
Python type object *type*. Fields not defined by the Python object header
Python type object *typeobj* (``PyTypeObject*``).
Fields not defined by the Python object header
are not initialized; the object's reference count will be one. The size of
the memory allocation is determined from the :c:member:`~PyTypeObject.tp_basicsize` field of
the type object.
.. c:function:: TYPE* PyObject_NewVar(TYPE, PyTypeObject *type, Py_ssize_t size)
.. c:macro:: PyObject_NewVar(TYPE, typeobj, size)
Allocate a new Python object using the C structure type *TYPE* and the
Python type object *type*. Fields not defined by the Python object header
Python type object *typeobj* (``PyTypeObject*``).
Fields not defined by the Python object header
are not initialized. The allocated memory allows for the *TYPE* structure
plus *size* fields of the size given by the :c:member:`~PyTypeObject.tp_itemsize` field of
*type*. This is useful for implementing objects like tuples, which are
plus *size* (``Py_ssize_t``) fields of the size
given by the :c:member:`~PyTypeObject.tp_itemsize` field of
*typeobj*. This is useful for implementing objects like tuples, which are
able to determine their size at construction time. Embedding the array of
fields into the same allocation decreases the number of allocations,
improving the memory management efficiency.
.. c:function:: void PyObject_Del(void *op)
Releases memory allocated to an object using :c:func:`PyObject_New` or
:c:func:`PyObject_NewVar`. This is normally called from the
Releases memory allocated to an object using :c:macro:`PyObject_New` or
:c:macro:`PyObject_NewVar`. This is normally called from the
:c:member:`~PyTypeObject.tp_dealloc` handler specified in the object's type. The fields of
the object should not be accessed after this call as the memory is no
longer a valid Python object.
Expand Down
2 changes: 1 addition & 1 deletion Doc/c-api/apiabiversion.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ See :ref:`stable` for a discussion of API and ABI stability across versions.

Use this for numeric comparisons, e.g. ``#if PY_VERSION_HEX >= ...``.

This version is also available via the symbol :data:`Py_Version`.
This version is also available via the symbol :c:var:`Py_Version`.

.. c:var:: const unsigned long Py_Version
Expand Down
6 changes: 6 additions & 0 deletions Doc/c-api/bool.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ creation and deletion functions don't apply to booleans. The following macros
are available, however.


.. c:var:: PyTypeObject PyBool_Type
This instance of :c:type:`PyTypeObject` represents the Python boolean type; it
is the same object as :class:`bool` in the Python layer.


.. c:function:: int PyBool_Check(PyObject *o)
Return true if *o* is of type :c:data:`PyBool_Type`. This function always
Expand Down
2 changes: 1 addition & 1 deletion Doc/c-api/buffer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ the elements exposed by an :class:`array.array` can be multi-byte values.

An example consumer of the buffer interface is the :meth:`~io.BufferedIOBase.write`
method of file objects: any object that can export a series of bytes through
the buffer interface can be written to a file. While :meth:`write` only
the buffer interface can be written to a file. While :meth:`!write` only
needs read-only access to the internal contents of the object passed to it,
other methods such as :meth:`~io.BufferedIOBase.readinto` need write access
to the contents of their argument. The buffer interface allows objects to
Expand Down
24 changes: 12 additions & 12 deletions Doc/c-api/bytes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,39 +64,39 @@ called with a non-bytes parameter.
+-------------------+---------------+--------------------------------+
| Format Characters | Type | Comment |
+===================+===============+================================+
| :attr:`%%` | *n/a* | The literal % character. |
| ``%%`` | *n/a* | The literal % character. |
+-------------------+---------------+--------------------------------+
| :attr:`%c` | int | A single byte, |
| ``%c`` | int | A single byte, |
| | | represented as a C int. |
+-------------------+---------------+--------------------------------+
| :attr:`%d` | int | Equivalent to |
| ``%d`` | int | Equivalent to |
| | | ``printf("%d")``. [1]_ |
+-------------------+---------------+--------------------------------+
| :attr:`%u` | unsigned int | Equivalent to |
| ``%u`` | unsigned int | Equivalent to |
| | | ``printf("%u")``. [1]_ |
+-------------------+---------------+--------------------------------+
| :attr:`%ld` | long | Equivalent to |
| ``%ld`` | long | Equivalent to |
| | | ``printf("%ld")``. [1]_ |
+-------------------+---------------+--------------------------------+
| :attr:`%lu` | unsigned long | Equivalent to |
| ``%lu`` | unsigned long | Equivalent to |
| | | ``printf("%lu")``. [1]_ |
+-------------------+---------------+--------------------------------+
| :attr:`%zd` | :c:type:`\ | Equivalent to |
| ``%zd`` | :c:type:`\ | Equivalent to |
| | Py_ssize_t` | ``printf("%zd")``. [1]_ |
+-------------------+---------------+--------------------------------+
| :attr:`%zu` | size_t | Equivalent to |
| ``%zu`` | size_t | Equivalent to |
| | | ``printf("%zu")``. [1]_ |
+-------------------+---------------+--------------------------------+
| :attr:`%i` | int | Equivalent to |
| ``%i`` | int | Equivalent to |
| | | ``printf("%i")``. [1]_ |
+-------------------+---------------+--------------------------------+
| :attr:`%x` | int | Equivalent to |
| ``%x`` | int | Equivalent to |
| | | ``printf("%x")``. [1]_ |
+-------------------+---------------+--------------------------------+
| :attr:`%s` | const char\* | A null-terminated C character |
| ``%s`` | const char\* | A null-terminated C character |
| | | array. |
+-------------------+---------------+--------------------------------+
| :attr:`%p` | const void\* | The hex representation of a C |
| ``%p`` | const void\* | The hex representation of a C |
| | | pointer. Mostly equivalent to |
| | | ``printf("%p")`` except that |
| | | it is guaranteed to start with |
Expand Down
4 changes: 2 additions & 2 deletions Doc/c-api/capsule.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Refer to :ref:`using-capsules` for more information on using these objects.
The *name* parameter must compare exactly to the name stored in the capsule.
If the name stored in the capsule is ``NULL``, the *name* passed in must also
be ``NULL``. Python uses the C function :c:func:`strcmp` to compare capsule
be ``NULL``. Python uses the C function :c:func:`!strcmp` to compare capsule
names.
Expand Down Expand Up @@ -121,7 +121,7 @@ Refer to :ref:`using-capsules` for more information on using these objects.
compared.)
In other words, if :c:func:`PyCapsule_IsValid` returns a true value, calls to
any of the accessors (any function starting with :c:func:`PyCapsule_Get`) are
any of the accessors (any function starting with ``PyCapsule_Get``) are
guaranteed to succeed.
Return a nonzero value if the object is valid and matches the name passed in.
Expand Down
2 changes: 1 addition & 1 deletion Doc/c-api/cell.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Cell objects are not likely to be useful elsewhere.
The type object corresponding to cell objects.


.. c:function:: int PyCell_Check(ob)
.. c:function:: int PyCell_Check(PyObject *ob)
Return true if *ob* is a cell object; *ob* must not be ``NULL``. This
function always succeeds.
Expand Down
14 changes: 7 additions & 7 deletions Doc/c-api/code.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ bound into a function.
Return the number of free variables in *co*.
.. c:function:: PyCodeObject* PyUnstable_Code_New(int argcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *linetable, PyObject *exceptiontable)
.. c:function:: PyCodeObject* PyUnstable_Code_New(int argcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, PyObject *qualname, int firstlineno, PyObject *linetable, PyObject *exceptiontable)
Return a new code object. If you need a dummy code object to create a frame,
use :c:func:`PyCode_NewEmpty` instead.
Since the definition of the bytecode changes often, calling
:c:func:`PyCode_New` directly can bind you to a precise Python version.
:c:func:`PyUnstable_Code_New` directly can bind you to a precise Python version.
The many arguments of this function are inter-dependent in complex
ways, meaning that subtle changes to values are likely to result in incorrect
execution or VM crashes. Use this function only with extreme care.
.. versionchanged:: 3.11
Added ``exceptiontable`` parameter.
Added ``qualname`` and ``exceptiontable`` parameters.
.. index:: single: PyCode_New
Expand All @@ -56,17 +56,17 @@ bound into a function.
The old name is deprecated, but will remain available until the
signature changes again.
.. c:function:: PyCodeObject* PyUnstable_Code_NewWithPosOnlyArgs(int argcount, int posonlyargcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *linetable, PyObject *exceptiontable)
.. c:function:: PyCodeObject* PyUnstable_Code_NewWithPosOnlyArgs(int argcount, int posonlyargcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, PyObject *qualname, int firstlineno, PyObject *linetable, PyObject *exceptiontable)
Similar to :c:func:`PyCode_New`, but with an extra "posonlyargcount" for positional-only arguments.
The same caveats that apply to ``PyCode_New`` also apply to this function.
Similar to :c:func:`PyUnstable_Code_New`, but with an extra "posonlyargcount" for positional-only arguments.
The same caveats that apply to ``PyUnstable_Code_New`` also apply to this function.
.. index:: single: PyCode_NewWithPosOnlyArgs
.. versionadded:: 3.8 as ``PyCode_NewWithPosOnlyArgs``
.. versionchanged:: 3.11
Added ``exceptiontable`` parameter.
Added ``qualname`` and ``exceptiontable`` parameters.
.. versionchanged:: 3.12
Expand Down

0 comments on commit a67d2a8

Please sign in to comment.