diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2020-06-17 13:16:48 +0200 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2020-06-17 13:18:30 +0200 |
commit | ad6e273167a9fc81b6c3a6e4bd1b48b41b55f5dc (patch) | |
tree | e7c78594a00dc7422b21fa0ac2df30546efe99c8 | |
parent | 6933d867cdea2460c922c45702b7e60f3d133c2d (diff) | |
download | cython-ad6e273167a9fc81b6c3a6e4bd1b48b41b55f5dc.tar.gz |
Re-add "c_api_binop_methods" directive for backwards compatibility after reverting https://github.com/cython/cython/pull/3633 and force it to "False".
Closes #3688.
-rw-r--r-- | CHANGES.rst | 3 | ||||
-rw-r--r-- | Cython/Compiler/ModuleNode.py | 4 | ||||
-rw-r--r-- | Cython/Compiler/Options.py | 1 |
3 files changed, 8 insertions, 0 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index 1d82fa820..0ac6396c8 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,6 +8,9 @@ Cython Changelog Bugs fixed ---------- +* Fix a regression in 0.29.20 where ``__div__`` failed to be found in extension types. + (Github issue #3688) + * The deprecated C-API function ``PyUnicode_FromUnicode()`` is no longer used. Original patch by Inada Naoki. (Github issue #3677) diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index 05485ad5f..0a836310e 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -1223,6 +1223,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): type = entry.type scope = type.scope if scope: # could be None if there was an error + if not scope.directives['c_api_binop_methods']: + error(self.pos, + "The 'c_api_binop_methods' directive is only supported for forward compatibility" + " and must be True.") self.generate_exttype_vtable(scope, code) self.generate_new_function(scope, code, entry) self.generate_dealloc_function(scope, code) diff --git a/Cython/Compiler/Options.py b/Cython/Compiler/Options.py index a634aaf56..48695dbfc 100644 --- a/Cython/Compiler/Options.py +++ b/Cython/Compiler/Options.py @@ -178,6 +178,7 @@ _directive_defaults = { 'auto_pickle': None, 'cdivision': False, # was True before 0.12 'cdivision_warnings': False, + 'c_api_binop_methods': True, 'overflowcheck': False, 'overflowcheck.fold': True, 'always_allow_keywords': False, |