bpo-1635741: Convert _sre types to heap types and establish module state (PEP 384) by erlend-aasland · Pull Request #23393 · python/cpython (original) (raw)

But I want to know why this behavior is changed.

I find that odd as well. At first, I though it was just the AC that messed up the argument list, but it's not. The docstring is clearly there in line 1214. Try this:

>>> import re
>>> p = re.compile('')
>>> help(p.sub)

It seems to happen only with methods with the defining_class converter. Could it be a bug in AC?

UPDATE

Seems like dbm has the same problem. For example, the _dbm.dbm.keys method, which also has a defining_class converter, and is a method defined on a type belonging to the module:

>>> import dbm
>>> d = dbm.open('test.db', 'c')
>>> d
<_gdbm.gdbm object at 0x103eeb500>
>>> d.keys.__doc__  # <= this returns None iso. the docstring as defined in AC
>>> help(d.keys)    # <= this displays the docstring as defined in AC