* Docs: Move Enum functions and add examples
When the `Enum` functions `_add_alias_` and `_add_value_alias_` were added in de6bca9564, the documentation for them was done under `EnumType` instead of `Enum`.
This change moves them to the docs of the `Enum` class and adds an example for each function.
---------
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
* - Add an explainer guide (aka HOWTO, not how-to) for asyncio.
* Fix linter errors.
* - Enforce max line length of roughly 79 chars.
- Start sentences on new lines to minimize disruption of diffs.
* Add reference to subinterpreters.
* - Significantly reduce article size. Remove both example sections & "Which concurrency do I want" section.
* Align section-header lengths with section names.
* - Remove reference to deleted section.
* - Fix a variety of rote style guide items like title-alignment, use of ie and $, and so forth.
- Add links to other parts of the docs for keywords and objects like await, coro, task, future, etc.
* - One last title alignment.
* - Style nit.
* - Rework a variety of I statements.
* Lint fix.
* - Firm up commentary on yield from in corotuines.
* Update language comparing await and yield from.
* - Remove await-ing Tasks and futures section
* Update Doc/howto/a-conceptual-overview-of-asyncio.rst
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* Update Doc/howto/a-conceptual-overview-of-asyncio.rst
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* - Address comments related to style & writing flow.
* per-thread event loop note.
* Add section describing coroutines roots in generators.
* Phrasing tweak.
* Use asyncio.create_task instead of asyncio.Task
* Update Doc/howto/a-conceptual-overview-of-asyncio.rst
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* Update Doc/howto/a-conceptual-overview-of-asyncio.rst
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* small phrasing.
* Update Doc/howto/a-conceptual-overview-of-asyncio.rst
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* phrasing nit.
* style nits
* Update Doc/howto/a-conceptual-overview-of-asyncio.rst
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* phrasing nit
* Fix misnaming of async generator.
* phrasing nits.
* Update Doc/howto/a-conceptual-overview-of-asyncio.rst
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* Update Doc/howto/a-conceptual-overview-of-asyncio.rst
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* consistent spacing
* Update Doc/howto/a-conceptual-overview-of-asyncio.rst
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* phrasing nits
* Update Doc/howto/a-conceptual-overview-of-asyncio.rst
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* Update Doc/howto/a-conceptual-overview-of-asyncio.rst
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* Update Doc/howto/a-conceptual-overview-of-asyncio.rst
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* Update Doc/howto/a-conceptual-overview-of-asyncio.rst
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* add conclusion
* nits
* - Variety of style & grammar improvements thanks to ZeroIntensity's comments.
* - Make all directives start with a 3 space indent. Then 4 thereafter.
* - Use :linenos: instead of manually writing the line numbers.
* - Fix label typo for article.
* fix label link.
* Apply suggestions from code review
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* - introduce async-sleep name
* Phrasing
* nit
* ungendered octopus
* teammates
* jobs
* rework fella to penguin
* - remove byline; add seealso
* Change ref from asyncio to use seealso block.
* Remove typehints. Fix indentation in one code example.
* Slight rephrase for clarity.
* Make references point to asyncio. Wrap some long lines.
* - Variety of style/phrasing improvements based on PR feedback.
* phrasing.
* phrasing nit.
* Apply suggestions from code review
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* Update Doc/howto/a-conceptual-overview-of-asyncio.rst
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
* nit
* Apply suggestions from code review
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
* fix backticks.
* nits
* nit
* add section on asyncio.run
* title change under the hood.
* modify task coro example.
* howtos article link.
* prefer await without backticks.
* phrasing tweak.
* Rework phrasing around how await tasks pauses and returns control in the await section.
* move code block to beforfe explanation in coroutine under the hood.
* phrasing.
* link to yield from.
* style nits
* nit
* - Modify language re: event-loop cycling endlessly.
- Discuss why await was designed to not yield for coros.
* - Add a note about debug=True on asyncio.run to await coro section.
* clarity nit
* - Add two other references in seealso block.
* nit
* Language simplification
* Apply suggestions from code review
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* nit
* grammar fix.
* fix
* worker bees
* rework event loop paragraph to significantly deemphasize queues
* remove all references to queue besides the initial analogy.
* add note about garbage collection of tasks
* add practical note re: garbage collection
* phrasing nits
* re arrange note on task gc.
* line wrap nit
* Update Doc/howto/a-conceptual-overview-of-asyncio.rst
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* link to debug mode docs.
* readd part2 prefix.
* simplify title.
* fix titles. tihnk I messed this up earlier.
* avoid idiom in title.
* fix titles once agian.
* Apply suggestions from code review
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
* rework task gc example.
* phrasing tweak.
* tewak.
* nit
* nit
* nit
* nit
---------
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
The documentation incorrectly stated that generator.close() 'raises' a
GeneratorExit exception. This was misleading because the method doesn't
raise the exception to the caller - it sends the exception internally
to the generator and returns None.
Some curses module-level functions and window methods now raise
a `curses.error` when a call to a C curses function fails:
- Module-level functions: assume_default_colors, baudrate, cbreak,
echo, longname, initscr, nl, raw, termattrs, termname, and unctrl.
- Window methods: addch, addnstr, addstr, border, box, chgat,
getbkgd, inch, insstr, and insnstr.
In addition, `curses.window.refresh` and `curses.window.noutrefresh`
now raise a `TypeError` instead of a `curses.error` when called with an
incorrect number of arguments for pads.
See also ee36db5500 for similar
changes.
Extension builders must specify Py_GIL_DISABLED if they want to link to the free-threaded builds.
This was usually the case already, but this change guarantees it in all circumstances.
\Z was an error inherited from PCRE 0.95. It was fixed in PCRE 2.0.
In other engines, \Z means not “anchor at string end”, but
“anchor before optional newline at string end”.
\z means “anchor at string end” in most RE engines.
Add a developer-facing document describing the protocol used by
remote_exec(pid, script) to execute Python code in a running process.
This is intended to guide debugger and tool authors in reimplementing
the protocol.
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
Make `warnings.catch_warnings()` use a context variable for holding
the warning filtering state if the `sys.flags.context_aware_warnings`
flag is set to true. This makes using the context manager thread-safe in
multi-threaded programs.
Add the `sys.flags.thread_inherit_context` flag. If true, starting a new
thread with `threading.Thread` will use a copy of the context
from the caller of `Thread.start()`.
Both these flags are set to true by default for the free-threaded build
and false for the default build.
Move the Python implementation of warnings.py into _py_warnings.py.
Make _contextvars a builtin module.
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* Remove getopt and optparse deprecation notices
* Add new docs sections for command line app helper libraries
* Add guidance on choosing a CLI parsing library to the optparse docs
* Link to the new guidance from the argparse and getopt docs
* Reword intro in docs section for superseded stdlib modules
* Reframe the optparse->argparse guide as a migration guide
rather than as an upgrade guide
---------
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* Replace uses of `PyCell_GET` and `PyCell_SET`. These macros are not
safe to use in the free-threaded build. Use `PyCell_GetRef()` and
`PyCell_SetTakeRef()` instead.
* Since `PyCell_GetRef()` returns a strong rather than borrowed ref, some
code restructuring was required, e.g. `frame_get_var()` returns a strong
ref now.
* Add critical sections to `PyCell_GET` and `PyCell_SET`.
* Move critical_section.h earlier in the Python.h file.
* Add `PyCell_GET` to the free-threading howto table of APIs that return
borrowed refs.
* Add additional unit tests for free-threading.
Docs: Remove the logging howto potential promise of multiprocessing support in the future.
Stick to the facts and suggestions, don't provide hope where we're not going to
implement complexity that we'd rather the user implement themselves when
needed.
* gh-124370: Add "howto" for free-threaded Python
This is a guide aimed at people writing Python code, as oppposed to the
existing guide for C API extension authors.
* Add missing new line
* Update Doc/howto/free-threading-python.rst
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* interned -> immortalized
* Apply suggestions from code review
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
* Update Doc/howto/free-threading-python.rst
Co-authored-by: mpage <mpage@cs.stanford.edu>
* Update docs
* Apply suggestions from code review
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
* A few more updates
* Additional comment on immortal objects
* Mention specializing adaptive interpreter
* Remove trailing whitespace
* Remove mention of C macro
---------
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: mpage <mpage@cs.stanford.edu>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>