[issue47144] Allow setting __classcell__

2022-03-28 Thread Douglas Raillard
Douglas Raillard added the comment: EDIT: empty_list() is a class method of List, not ContainerBase -- ___ Python tracker <https://bugs.python.org/issue47

[issue47144] Allow setting __classcell__

2022-03-28 Thread Douglas Raillard
Douglas Raillard added the comment: > Would bpo-47143 "Add functools.copy_class() which updates closures" solve > your use case? This looks like a similar issue indeed. If I'm able to copy a class "cleanly" (as defined in this other thread), that may

[issue47144] Allow setting __classcell__

2022-03-28 Thread Douglas Raillard
New submission from Douglas Raillard : The cell object __classcell__ currently cannot be set by code invoked by metaclass.__new__. Attempts to do so will be caught by builtin___build_class__ in bltimodule.c: } else { const char *msg

[issue45830] Custom pickler memory leak

2021-11-17 Thread Douglas Raillard
New submission from Douglas Raillard : The following script exhibits the memory leak. It only happens if "dispatch_table" is set _before_ calling super().__init__, which is pretty unexpected. import pickle import io import gc import tracemalloc tracemallo

[issue22239] asyncio: nested event loop

2021-08-19 Thread Douglas Raillard
Douglas Raillard added the comment: Drive by comment: I landed on this thread for the exact same reason: > This situation is very frequent when e.g. a library is designed to be > async-first, and also provides a blocking API which just wraps the async code > by running it until

[issue44749] LOAD_NAME not using PyObject_GetItem when globals() is a dict subclass

2021-08-05 Thread Douglas Raillard
Douglas Raillard added the comment: I ended up with a slightly different API that allows me to preemptively set some global names before the code runs in the module, so my use case sort of vanished. I don't think there is a real need of beating the dead horse here. My only suggestion o

[issue44749] LOAD_NAME not using PyObject_GetItem when globals() is a dict subclass

2021-07-29 Thread Douglas Raillard
Douglas Raillard added the comment: Looks like it is, for some reason I did not find these previous issues when looking for existing ones. -- ___ Python tracker <https://bugs.python.org/issue44

[issue44749] LOAD_NAME not using PyObject_GetItem when globals() is a dict subclass

2021-07-27 Thread Douglas Raillard
New submission from Douglas Raillard : Re-raising the bug reported by Kevin Shweh: thread: https://bugs.python.org/issue14385 message: https://bugs.python.org/msg337245 Here is a copy for easier reference: The patch for this issue changed LOAD_GLOBAL to use PyObject_GetItem when globals() is

[issue43460] Exception copy error

2021-03-10 Thread Douglas Raillard
Douglas Raillard added the comment: The solution based on the signature is something along those lines: class E(BaseException): def __new__(cls, *args, **kwargs): """ Fix exception copying. Turn all the keyword arguments

[issue43460] Exception copy error

2021-03-10 Thread Douglas Raillard
New submission from Douglas Raillard : Instances of subclasses of BaseException created with keyword argument fail to copy properly as demonstrated by: import copy class E(BaseException): def __init__(self, x): self.x=x # works fine e = E(None

[issue43102] namedtuple's __new__.__globals__['__builtins__'] is None

2021-02-05 Thread Douglas Raillard
Douglas Raillard added the comment: Thanks for looking into this issue -- ___ Python tracker <https://bugs.python.org/issue43102> ___ ___ Python-bugs-list mailin

[issue43102] namedtuple's __new__.__globals__['__builtins__'] is None

2021-02-03 Thread Douglas Raillard
Douglas Raillard added the comment: I did hit the issue while porting a tool to Python 3.9: https://github.com/ARM-software/lisa/pull/1585/commits/a4cd3aa1ad339ebfe59cc9e2ae290bb3788c900d It basically infers valid Python expressions from type annotations (some sort of inverse type checker

[issue43102] namedtuple's __new__.__globals__['__builtins__'] is None

2021-02-02 Thread Douglas Raillard
New submission from Douglas Raillard : When creating a namedtuple such as this one: from collections import namedtuple class C(namedtuple('C', ('hello', 'world'))): pass print(C.__new__.__globals__) The globals' dict of __new__ contain