[issue45184] Add `pop` function to remove context manager from (Async)ExitStack

2022-02-23 Thread Andreas H.
Andreas H. added the comment: Inside the discussion an ExitPool class is sketched (https://mail.python.org/archives/list/python-id...@python.org/message/66W55FRCYMYF73TVMDMWDLVIZK4ZDHPD/), which provides this removal of context managers. What I learned is that this would have different

[issue46333] ForwardRef.__eq__ does not respect module parameter

2022-02-11 Thread Andreas H.
Change by Andreas H. : -- pull_requests: +29443 pull_request: https://github.com/python/cpython/pull/31283 ___ Python tracker <https://bugs.python.org/issue46

[issue46369] get_type_hints does not evaluate ForwardRefs inside NewType

2022-01-14 Thread Andreas H.
Andreas H. added the comment: Allright. B) sounds good to me. I dont think I have time today, so please feel to tackle the issue. If not I can look at it the next week. -- ___ Python tracker <https://bugs.python.org/issue46

[issue46373] TypedDict and NamedTuple do not evaluate cross-module ForwardRef in all cases

2022-01-14 Thread Andreas H.
New submission from Andreas H. : TypedDict does not resolve cross-module ForwardRefs when the ForwardRef is not a direct one. In other words the fix GH-27017 (issue 41249) for TypedDict seems incomplete. The same issue seem to exist for NamedTuple. Example: #module.py TD

[issue46371] A better way to resolve ForwardRefs in type aliases across modules

2022-01-13 Thread Andreas H.
New submission from Andreas H. : (De)Serialization of in-memory data structures is an important application. However there is a rather unpleasant issue with ForwardRefs. One cannot export type aliases when they contain ForwardRefs (and expect things to work). Consider the example

[issue46369] get_type_hints does not evaluate ForwardRefs inside NewType

2022-01-13 Thread Andreas H.
New submission from Andreas H. : Consider the following: NewT = typing.NewType("NewT", typing.List[typing.Optional['Z']] ) class Z: pass Now get_type_hints() does not resolve the ForwardRef within NewType (but it does so for TypedDict, dataclasses, NamedTuple).

[issue46333] ForwardRef.__eq__ does not respect module parameter

2022-01-12 Thread Andreas H.
Andreas H. added the comment: Ah, let me add one point: PEP563 (-> `from __future__ import annotations`) is also not helping. Even with PEP563 enabled, the JSON example Json = Union[ List['Json'], Dict[str, 'Json'], int, float, bool, None ] needs to be written in exact the same

[issue46333] ForwardRef.__eq__ does not respect module parameter

2022-01-12 Thread Andreas H.
Andreas H. added the comment: Yeah, sure. The use-case is (de)serialization. Right now I use the library cattr, but there are many others. If you are interested there is related discussion in the cattr board [1]. The original problem is how to define the types for serialization. 1

[issue46333] ForwardRef.__eq__ does not respect module parameter

2022-01-10 Thread Andreas H.
Andreas H. added the comment: I will give it a try. -- ___ Python tracker <https://bugs.python.org/issue46333> ___ ___ Python-bugs-list mailing list Unsub

[issue46333] ForwardRef.__eq__ does not respect module parameter

2022-01-10 Thread Andreas H.
New submission from Andreas H. : The __eq__ method of ForwardRef does not take into account the module parameter. However, ForwardRefs with dissimilar module parameters are referring to different types even if they have different name. Thus also the ForwardRef's with same name

[issue45184] Add `pop` function to remove context manager from (Async)ExitStack

2021-09-13 Thread Andreas H.
Andreas H. added the comment: I see your point. But even with `pop` or `remove` it is still a stack or stack-like. In the normal case the context managers are still released in reverse order as they were added. Order cannot be changed arbitrarily. There is just the additional function

[issue45184] Add `pop` function to remove context manager from (Async)ExitStack

2021-09-13 Thread Andreas H.
New submission from Andreas H. : Currently it is not possible to remove context managers from an ExitStack (or AsyncExitStack). Workarounds are difficult and generally do accesses implementation details of (Async)ExitStack. See e.g. https://stackoverflow.com/a/37607405. It could be done

[issue44795] asyncio.run does not allow for graceful shutdown of main task

2021-07-31 Thread Andreas H.
New submission from Andreas H. : The issue is that the main task (which was supplied to asyncio.run) has no chance to clean up its "own" sub-tasks and handle possible exceptions that occur during the sub-task clean up. It prevents a graceful shutdown. There is no way to prevent t