Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2e4e026

Browse files
committed
Surprising fix for SF bug 563060: module can be used as base class.
Change the module constructor (module_init) to have the signature __init__(name:str, doc=None); this prevents the call from type_new() to succeed. While we're at it, prevent repeated calling of module_init for the same module from leaking the dict, changing the semantics so that __dict__ is only initialized if NULL. Also adding a unittest, test_module.py. This is an incompatibility with 2.2, if anybody was instantiating the module class before, their argument list was probably empty; so this can't be backported to 2.2.x.
1 parent c3a787e commit 2e4e026

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Misc/NEWS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ Type/class unification and new-style classes
66

77
Core and builtins
88

9+
- The constructor for the module type now requires a name argument and
10+
takes an optional docstring argument. Previously, this constructor
11+
ignored its arguments. As a consequence, deriving a class from a
12+
module (not from the module type) is now illegal; previously this
13+
created an unnamed module, just like invoking the module type did.
14+
[SF bug 563060]
15+
916
- A new warning PendingDeprecationWarning was added to provide
1017
direction on features which are in the process of being deprecated.
1118
The warning will not be printed by default. To see the pending

0 commit comments

Comments
 (0)