Closed
Description
Bug report
Bug description:
Running this file:
import symtable st = symtable.symtable(""" class X: class Nested: pass type Alias = int x = (x for x in range(10)) y = filter(lambda z: z % 2, range(10)) """, "mod", "exec") cls = st.get_children()[0] print(cls.get_methods())
Prints:
('Nested', 'Alias', 'genexpr', 'lambda')
None of these are methods.
@carljm and I noticed this as part of the work on PEP 649 (#119361 (comment)). My draft implementation excludes generated __annotate__
functions from the list of "methods", but perhaps all non-methods should be excluded.
CPython versions tested on:
3.12, CPython main branch
Operating systems tested on:
macOS
Linked PRs
- gh-119698: deprecate
symtable.Class.get_methods
#120148 - gh-119698: fix
symtable.Class.get_methods
and document its behaviour correctly #120151 - [3.12] gh-119698: fix
symtable.Class.get_methods
and document its behaviour correctly (#120151) #120776 - [3.13] gh-119698: fix
symtable.Class.get_methods
and document its behaviour correctly (GH-120151) #120777 - gh-119698: symtable: Fix merge race #120779
- gh-119698: fix a special case in
symtable.Class.get_methods
#121802 - gh-119698: deprecate
symtable.Class.get_methods
#121902 - [3.13] gh-119698: fix a special case in
symtable.Class.get_methods
(GH-121802) #121909 - [3.12] gh-119698: fix a special case in
symtable.Class.get_methods
(GH-121802) #121910