Some systems reportedly don't expand '%OB' and '%Ob'.
In this case (and similar theoretically possible ones, like expanding to empty
string or 'OB'), fall back to the month_name & month_abbr.
* 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>
Remove the `__dict__` and `__weakref__` descriptors from the original class when creating a dataclass from it.
An interesting hack, but more localized in scope than gh-135230.
This may be a breaking change if people intentionally keep the original class around
when using `@dataclass(slots=True)`, and then use `__dict__` or `__weakref__` on the
original class.
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Enough other classes in `importlib.abc` inherit from the class and the deprecation was to redirect people to `TraversableResources`. The documentation now makes it clear the class only exists for backwards compatibility.
---------
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
The `PyEval_SetProfileAllThreads` function and other related functions
had a race condition on `tstate->c_profilefunc` that could lead to a
crash when disable profiling or tracing on all threads while another
thread is starting to profile or trace a a call.
There are still potential crashes when threads exit concurrently with
profiling or tracing be enabled/disabled across all threads.
* - 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>
* gh-106320: Remove private _PyInterpreterState functions (#106335)
Remove private _PyThreadState and _PyInterpreterState C API
functions: move them to the internal C API (pycore_pystate.h and
pycore_interp.h). Don't export most of these functions anymore, but
still export functions used by tests.
Remove _PyThreadState_Prealloc() and _PyThreadState_Init() from the C
API, but keep it in the stable API.
* Doc: minor change
* Revert "Doc: minor change"
This reverts commit ebfa0937c2.
* [Doc] Remove unnecessary quotes from typing (See Also section)
* [Doc] Remove unnecessary quotes from typing
---------
Co-authored-by: Victor Stinner <vstinner@python.org>
These are tests to ensure behaviour introduced by GH-136189 is working as expected.
Co-authored-by: Mikhail Borisov <43937008+fxeqxmulfx@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
Fix a bug caused by the garbage collector clearing weakrefs too early. The
weakrefs in the ``tp_subclasses`` dictionary are needed in order to correctly
invalidate type caches (for example, by calling ``PyType_Modified()``).
Clearing weakrefs before calling finalizers causes the caches to not be
correctly invalidated. That can cause crashes since the caches can refer to
invalid objects. Defer the clearing of weakrefs without callbacks until after
finalizers are executed.
In GH-116206, the comment about moving reachable objects to next generation
got moved from its original place to a place where there is no code below
it. Put the comment back to where the actual movement of reachable objects
happens.
* Return large limit values as positive integers instead of negative integers
in resource.getrlimit().
* Accept large values and reject negative values (except RLIM_INFINITY)
for limits in resource.setrlimit().
Update `validate_abstract_methods` in `test_collections.py`
The test for missing abstract methods in `validate_abstract_methods` incorrectly attempted to instantiate the generated class `C` with an argument (`C(name)`), which always raises a `TypeError: C() takes no arguments`. Although the test originally passes, it passes for the wrong reason.
This change makes the test correctly validate the enforcement of abstract methods in ABCs.