Commit Graph

883 Commits

Author SHA1 Message Date
Ethan Furman d48760b2f1
gh-108682: [Enum] raise TypeError if super().__new__ called in custom __new__ (GH-108704)
When overriding the `__new__` method of an enum, the underlying data type should be created directly; i.e. .

    member = object.__new__(cls)
    member = int.__new__(cls, value)
    member = str.__new__(cls, value)

Calling `super().__new__()` finds the lookup version of `Enum.__new__`, and will now raise an exception when detected.
2023-08-31 12:45:12 -07:00
Victor Stinner 2928e5dc65
gh-108494: Argument Clinic: Document how to generate code that uses the limited C API (#108584)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-08-30 16:02:48 +02:00
Hugo van Kemenade c7cef54631
gh-101100: Fix Sphinx warnings in the Logging Cookbook (#108678) 2023-08-30 14:37:45 +03:00
Daniele Procida 809ea7c4b6
gh-107432 Update Porting Python 2 Code to Python 3 how-to (GH-107434)
https://docs.python.org/3/howto/pyporting.html#porting-python-2-code-to-python-3 was written for another time. In this patch:

- material that frames Python 3 as "new" is removed
- descriptions and directions have been trimmed
2023-08-24 11:28:23 +02:00
David Lechner 47022a079e
docs: fix grammar in isolating-extensions.rst (#108037) 2023-08-21 15:41:34 +00:00
Serhiy Storchaka 2f311437cd
gh-107704: Argument Clinic: add support for deprecating keyword use of parameters (GH-107984)
It is now possible to deprecate passing keyword arguments for
keyword-or-positional parameters with Argument Clinic, using the new
'/ [from X.Y]' syntax.
(To be read as "positional-only from Python version X.Y")

Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-08-19 10:13:35 +03:00
Erlend E. Aasland 34cafd35e3
Docs: clean up Argument Clinic howto's (#107797)
- fix formatting in @text_signature howto and NEWS entry
- fix formatting and example text in deprecate-positionals howto
2023-08-09 09:43:02 +02:00
Erlend E. Aasland 0be3743f54
gh-104683: Add --exclude option to Argument Clinic CLI (#107770)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-08-08 20:50:54 +00:00
Erlend E. Aasland a9aeb99579
gh-86457: Add docs for Argument Clinic @text_signature directive (#107747)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-08-08 08:42:08 +02:00
Erlend E. Aasland 33cb0b06ef
gh-95065: Add Argument Clinic support for deprecating positional use of parameters (#95151)
It is now possible to deprecate passing parameters positionally with
Argument Clinic, using the new '* [from X.Y]' syntax.
(To be read as "keyword-only from Python version X.Y")

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-08-07 11:28:08 +00:00
Erlend E. Aasland a6675b1a59
Docs: Argument Clinic: Move the CConverter class to the reference (#107671) 2023-08-07 02:08:34 +02:00
Erlend E. Aasland 4a5b4221e3
Docs: Argument Clinic: Improve 'How to write a custom converter' (#107328)
- Omit unneccesary wording and sentences
- Don't mention implementation details (no digression, explanation)

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2023-08-05 20:19:37 +00:00
Daniele Procida 5e2746d6e2
gh-107432 Fix incorrect indentation in annotations HOWTO (#107445)
gh-107432 Fix incorrect indentation in annotations document

Body text in https://docs.python.org/3/howto/annotations.html was
indented throughout, and was being rendered in blockquote elements.
2023-08-05 14:28:28 +03:00
Eric Snow fb344e99aa
gh-107306: Add a Doc Entry for Py_mod_multiple_interpreters (#107403)
It was added in 3.12 for PEP 684 (per-interpreter GIL).
2023-07-31 17:03:01 -06:00
Erlend E. Aasland abb71c6a8f
gh-107507: Replace 'The goals of Argument Clinic' with a summary (#107508)
Summarise the goals of Argument Clinic in a single sentence.
Mention that Argument Clinic was introduced with PEP-436.
2023-07-31 23:33:13 +02:00
Serhiy Storchaka f2d07d3289
gh-101100: Sphinx warnings: pick the low hanging fruits (GH-107386) 2023-07-29 08:48:10 +03:00
Serhiy Storchaka 983305268e
gh-107298: Fix yet more Sphinx warnings in the C API doc (GH-107345) 2023-07-27 18:44:32 +03:00
Erlend E. Aasland 2ad699002e
Docs: Argument Clinic: Restructure "Basic concepts and usage" (#106981)
Split "Basic concepts and usage" into:

- Reference
  - Terminology
  - CLI reference

- Background
  - Basic concepts

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2023-07-26 22:08:43 +00:00
Erlend E. Aasland 592395577c
Docs: Remove the numbered steps from the Argument Clinic tutorial (#107203)
Instead, order the tutorial as one body of prose, making it easier to
align the tutorial according to Diátaxis principles.
2023-07-26 22:54:25 +02:00
Serhiy Storchaka af61cb9c78
gh-107091: Fix some uses of :c:member: role (GH-107129) 2023-07-26 22:16:06 +03:00
Erlend E. Aasland ff5f94b72c
Docs: Add missing markup to Argument Clinic docs (#106876)
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-07-24 15:22:18 +00:00
Hakan Celik ebe44a5155
Docs: Remove duplicate word in Argument Clinic howto heading (#107169) 2023-07-24 13:54:39 +02:00
Erlend E. Aasland b447e19e72
gh-106948: Docs: Disable links for C standard library functions, OS utility functions and system calls (#107062)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-07-23 22:56:56 +02:00
Serhiy Storchaka 08a228da05
gh-107091: Fix the use of some C domain roles (#107092) 2023-07-23 12:27:05 +02:00
wulmer f5147c0cfb
gh-101100: Fix some broken sphinx references (#107095) 2023-07-23 03:23:44 -06:00
Tomas R dcd7acb04a
gh-54738: Add argparse i18n howto (#104562) 2023-07-23 11:10:38 +02:00
Serhiy Storchaka fcc816dbff
gh-106919: Use role :c:macro: for referencing the C "constants" (GH-106920) 2023-07-21 10:52:07 +03:00
Erlend E. Aasland 81861fd90b
Docs: Argument Clinic: Add Background and Tutorial top-level sections (#106904)
Add Background as a toplevel section with the following subsections:

- Background
  - The goals of Argument Clinic
  - Basic concepts and usage

Rename "Converting your first function" to Tutorial.

Add anchors for Background, Tutorial, and How-to Guides:

- :ref:`clinic-background`
- :ref:`clinic-tutorial`
- :ref:`clinic-howtos`

Link to these from within the Abstract.

Break the compatibility paragraph out of Abstract and make it a note.

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2023-07-21 08:05:41 +02:00
Erlend E. Aasland 505eede38d
Docs: Argument Clinic: Group guides about default values (#106872)
Previous ToC layout (excerpt):                                                                                          

    - How to use symbolic default values
    ...
    - How to assign default values to parameter
      - How to use the ``NULL`` default value
      - How to use expressions as default values

New layout:

    - How to assign default values to parameter
      - The ``NULL`` default value
      - Symbolic default values
      - Expressions as default values
2023-07-19 00:46:50 +02:00
Erlend E. Aasland 4cb0b9c0a9
Docs: Normalise Argument Clinic advanced topics headings (#106842)
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2023-07-18 10:50:17 +02:00
Erlend E. Aasland 8c17729489
Docs: Normalize Argument Clinic How-To section capitalization (#106788) 2023-07-16 00:42:58 +02:00
Nikita Sobolev 4ff5690e59
gh-105332: [Enum] Fix unpickling flags in edge-cases (GH-105348)
* revert enum pickling from by-name to by-value

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2023-06-08 11:40:15 -07:00
Victor Stinner bae415ad02
gh-102304: doc: Add links to Stable ABI and Limited C API (#105345)
* Add "limited-c-api" and "stable-api" references.
* Rename "stable-abi-list" reference to "limited-api-list".
* Makefile: Document files regenerated by "make regen-limited-abi"
* Remove first empty line in generated files:

  - Lib/test/test_stable_abi_ctypes.py
  - PC/python3dll.c
2023-06-06 08:40:32 +00:00
Mathieu Dupuy 151b6bfb5d
howto/urllib2: remove link to an outdated french translation (GH-104193)
We now have our own translation and it's not outdated
2023-05-22 15:03:29 +02:00
gsallam be0c106789
gh-103295: expose API for writing perf map files (#103546)
Co-authored-by: Aniket Panse <aniketpanse@fb.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Carl Meyer <carl@oddbird.net>
2023-05-21 11:12:24 +01:00
Erlend E. Aasland b2c1b4da19
gh-104389: Add 'unused' keyword to Argument Clinic C converters (#104390)
Use the unused keyword param in the converter to explicitly
mark an argument as unused:

    /*[clinic input]
    SomeBaseClass.stubmethod
        flag: bool(unused=True)
    [clinic start generated code]*/
2023-05-12 10:34:00 +02:00
Hugo van Kemenade 13ac1766bc
gh-103960: Dark mode: invert image brightness (#103983) 2023-05-10 16:46:37 +03:00
Erlend E. Aasland 721a78395d
gh-64658: Expand Argument Clinic return converter docs (#104175) 2023-05-05 13:32:00 +02:00
Hugo van Kemenade 5b05b013ff
gh-101100: Fix Sphinx warnings in `curses` and `curses.ascii` modules (#103457)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-05-02 23:09:04 -06:00
Rafael Fontenelle 68ed2a2a3f
GH-103484: Fix redirected permanently URLs (#104001)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
2023-05-02 09:34:44 +03:00
Hugo van Kemenade 79ae019164
gh-101100: Fix Sphinx warnings in `argparse` module (#103289)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2023-04-24 15:36:32 -06:00
Rafael Fontenelle caed49448d
GH-103484: Fix broken links reported by linkcheck (#103608)
* Doc: Fix broken links reported by linkcheck

* Apply suggestions from code review

- Remove extra diff line in faq/library.rst (merwok)
- Use HTTPS to link Unicode 15.0.0 to solve a redirect (hugovk)
- Use wayback machine link for openssl 1.1.0 instead of linking 1.1.1, "as this text mentions a feature from 1.1.0" (hugovk)

Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>

* Doc: Make mark-up code as literal

* Doc: Alphabetize items in linkcheck_ignore

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>

* Doc: Improve comment in sphinx conf

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>

---------

Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-04-22 08:24:47 -06:00
Raymond Hettinger 7b134d3e71
Descriptor HowTo: Update to include attributes added in Python 3.10 (GH-103666) 2023-04-22 08:29:40 -05:00
Ethan Furman 700ec657c8
gh-103596: [Enum] do not shadow mixed-in methods/attributes (GH-103600)
For example:

    class Book(StrEnum):
        title = auto()
        author = auto()
        desc = auto()

    Book.author.desc is Book.desc

but

    Book.author.title() == 'Author'

is commonly expected.  Using upper-case member names avoids this confusion and possible performance impacts.

Co-authored-by: samypr100 <3933065+samypr100@users.noreply.github.com>
2023-04-18 16:19:23 -07:00
AN Long 282f0d26e3
Fix syntax typo in isolating extensions doc (#103516) 2023-04-14 00:40:25 -07:00
Boris Verkhovskiy a3d313a9e2
Proofread howto/perf_profiling.rst (#103530) 2023-04-13 20:07:49 -07:00
Ethan Furman a6f95941a3
gh-103479: [Enum] require __new__ to be considered a data type (GH-103495)
a mixin must either have a __new__ method, or be a dataclass, to be interpreted as a data-type
2023-04-13 08:31:03 -07:00
Ethan Furman 4ec8dd10bd
gh-93910: [Enum] remove member.member deprecation (GH-103236)
i.e. Color.RED.BLUE is now officially supported.
2023-04-05 17:33:52 -07:00
Ethan Furman 810d365b5e
gh-103056: [Enum] use staticmethod decorator for _gnv_ (GH-103231)
_gnv_ --> _generate_next_value_
2023-04-03 17:47:40 -07:00
Ethan Furman 5ffc1e5a21
gh-98298, gh-74730: [Enum] update docs (GH-103163)
fix FlagBoundary statements
add warning about reloading modules and enum identity
2023-04-03 14:57:42 -07:00