]> granicus.if.org Git - python/commit
[3.6] bpo-31588: Validate return value of __prepare__() methods (GH-3790)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 27 Sep 2017 16:21:33 +0000 (09:21 -0700)
committerNick Coghlan <ncoghlan@gmail.com>
Wed, 27 Sep 2017 16:21:33 +0000 (02:21 +1000)
commit084f80b82c564c8a3cef26fc6e56da188a379be2
tree8cb66ebd9f41cb413dee48731c61a1fd37df8110
parentfdcf3e9629201ef725af629d99e02215a2d657c8
[3.6] bpo-31588: Validate return value of __prepare__() methods (GH-3790)

Class execution requires that __prepare__() methods return
a proper execution namespace. Check for that immediately
after calling __prepare__(), rather than passing it through
to the code execution machinery and potentially triggering
SystemError (in debug builds) or a cryptic TypeError
(in release builds).

Patch by Oren Milman.
(cherry picked from commit 5837d0418f47933b2e3c139bdee8a79c248a943c)
Lib/test/test_types.py
Misc/NEWS.d/next/Core and Builtins/2017-09-26-13-03-16.bpo-31588.wT9Iy7.rst [new file with mode: 0644]
Python/bltinmodule.c