Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C optimizations #60

Closed
bloodbare opened this issue Nov 15, 2016 · 6 comments
Closed

C optimizations #60

bloodbare opened this issue Nov 15, 2016 · 6 comments

Comments

@bloodbare
Copy link

When we are loading zope.interface on our projects the coptimizations are not loaded saying:

ImportError: No module named '_zope_interface_coptimizations'

If we change the import to zope.interface._zope_interface_coptimizations it works.

Python 3.5

jinty pushed a commit that referenced this issue Nov 15, 2016
@jinty
Copy link

jinty commented Nov 15, 2016

I made a branch for this, unfortunately a lot of tests fail with:

SystemError: Bad call flags in PyCFunction_Call. METH_OLDARGS is no longer supported!

when the optimizations are actually loaded

@tseaver
Copy link
Member

tseaver commented Nov 15, 2016

@jinty the bug you are seeing is described here. The following patch fixes it:

--- a/src/zope/interface/_zope_interface_coptimizations.c
+++ b/src/zope/interface/_zope_interface_coptimizations.c
@@ -25,6 +25,15 @@
 #define Py_TYPE(o) ((o)->ob_type)
 #endif

+#if PY_MAJOR_VERSION >= 3
+#define PY3K
+#endif
+
+#ifdef PY3K
+/* See http://bugs.python.org/issue15657 */
+#define METH_KEYWORDS 0x0003
+#endif
+
 static PyObject *str__dict__, *str__implemented__, *strextends;
 static PyObject *BuiltinImplementationSpecifications, *str__provides__;
 static PyObject *str__class__, *str__providedBy__;

BTW, I think we should be using absolute, rather than relative, imports.

@bloodbare
Copy link
Author

Agree on having absolute imports.

tseaver added a commit that referenced this issue Nov 15, 2016
- The bare import of '_zope_c_optimizations' prevented them from being
  used.

- After enabling them via absolute imports, they would fail due to
  http://bugs.python.org/issue15657.

Fixes #60.
@jinty
Copy link

jinty commented Nov 17, 2016

@tseaver thanks for carrying this on. I've deleted my branch.

I'm curious, why the preference for absolute imports?

On Tue, Nov 15, 2016 at 08:54:30AM -0800, Tres Seaver wrote:

@jinty the bug you are seeing is described here. The following patch fixes it:

--- a/src/zope/interface/_zope_interface_coptimizations.c
+++ b/src/zope/interface/_zope_interface_coptimizations.c
@@ -25,6 +25,15 @@
 #define Py_TYPE(o) ((o)->ob_type)
 #endif

+#if PY_MAJOR_VERSION >= 3
+#define PY3K
+#endif
+
+#ifdef PY3K
+/* See http://bugs.python.org/issue15657 */
+#define METH_KEYWORDS 0x0003
+#endif
+
 static PyObject *str__dict__, *str__implemented__, *strextends;
 static PyObject *BuiltinImplementationSpecifications, *str__provides__;
 static PyObject *str__class__, *str__providedBy__;

BTW, I think we should be using absolute, rather than relative, imports.

You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#60 (comment)

Brian Sutherland

@bloodbare
Copy link
Author

@tseaver can we have a release with this solution ?

@tseaver
Copy link
Member

tseaver commented Dec 13, 2016

@bloodbare 4.3.3 released.

jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Dec 19, 2016
4.3.3 (2016-12-13)
------------------

- Correct typos and ReST formatting errors in documentation.

- Add API documentation for the adapter registry.

- Ensure that the ``LICENSE.txt`` file is included in built wheels.

- Fix C optimizations broken on Py3k.  See the Python bug at:
  http://bugs.python.org/issue15657
  (zopefoundation/zope.interface#60)
clrpackages pushed a commit to clearlinux-pkgs/zope.interface that referenced this issue Feb 16, 2017
…rsion 4.3.3

Changes
=======

4.3.3 (2016-12-13)
------------------

- Correct typos and ReST formatting errors in documentation.

- Add API documentation for the adapter registry.

- Ensure that the ``LICENSE.txt`` file is included in built wheels.

- Fix C optimizations broken on Py3k.  See the Python bug at:
  http://bugs.python.org/issue15657
  (zopefoundation/zope.interface#60)
clrpackages pushed a commit to clearlinux-pkgs/zope.interface that referenced this issue Apr 24, 2017
…rsion 4.3.3

Changes
=======

4.3.3 (2016-12-13)
------------------

- Correct typos and ReST formatting errors in documentation.

- Add API documentation for the adapter registry.

- Ensure that the ``LICENSE.txt`` file is included in built wheels.

- Fix C optimizations broken on Py3k.  See the Python bug at:
  http://bugs.python.org/issue15657
  (zopefoundation/zope.interface#60)
clrpackages pushed a commit to clearlinux-pkgs/zope.interface that referenced this issue May 5, 2017
…rsion 4.3.3

Changes
=======

4.3.3 (2016-12-13)
------------------

- Correct typos and ReST formatting errors in documentation.

- Add API documentation for the adapter registry.

- Ensure that the ``LICENSE.txt`` file is included in built wheels.

- Fix C optimizations broken on Py3k.  See the Python bug at:
  http://bugs.python.org/issue15657
  (zopefoundation/zope.interface#60)
clrpackages pushed a commit to clearlinux-pkgs/zope.interface that referenced this issue May 15, 2017
…rsion 4.3.3

Changes
=======

4.3.3 (2016-12-13)
------------------

- Correct typos and ReST formatting errors in documentation.

- Add API documentation for the adapter registry.

- Ensure that the ``LICENSE.txt`` file is included in built wheels.

- Fix C optimizations broken on Py3k.  See the Python bug at:
  http://bugs.python.org/issue15657
  (zopefoundation/zope.interface#60)
clrpackages pushed a commit to clearlinux-pkgs/zope.interface that referenced this issue Jun 15, 2017
…rsion 4.3.3

Changes
=======

4.3.3 (2016-12-13)
------------------

- Correct typos and ReST formatting errors in documentation.

- Add API documentation for the adapter registry.

- Ensure that the ``LICENSE.txt`` file is included in built wheels.

- Fix C optimizations broken on Py3k.  See the Python bug at:
  http://bugs.python.org/issue15657
  (zopefoundation/zope.interface#60)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants