[pypy-commit] pypy seperate-strucmember_h: Failing test case! This is what I want to fix.

devin.jeanpierre pypy.commits at gmail.com
Tue Feb 9 16:33:28 EST 2016


Author: Devin Jeanpierre <jeanpierreda at gmail.com>
Branch: seperate-strucmember_h
Changeset: r82132:f6a0fb5629d9
Date: 2016-01-30 23:53 -0800
http://bitbucket.org/pypy/pypy/changeset/f6a0fb5629d9/

Log:	Failing test case! This is what I want to fix.

	Existing Python programs may (okay, do) use symbols from
	structmember.h, and this works in CPython because structmember.h is
	not included from Python.h.

	In PyPy, if you include Python.h, then you can't use the name RO,
	because it does in fact include structmember.h. (And, indeed, our
	Python.h says that we should not.)

diff --git a/pypy/module/cpyext/test/test_cpyext.py b/pypy/module/cpyext/test/test_cpyext.py
--- a/pypy/module/cpyext/test/test_cpyext.py
+++ b/pypy/module/cpyext/test/test_cpyext.py
@@ -863,3 +863,15 @@
                 os.unlink('_imported_already')
             except OSError:
                 pass
+
+    def test_no_structmember(self):
+        """structmember.h should not be included by default."""
+        mod = self.import_extension('foo', [
+            ('bar', 'METH_NOARGS',
+             '''
+             /* reuse a name that is #defined in structmember.h */
+             int RO;
+             Py_RETURN_NONE;
+             '''
+             ),
+        ])


More information about the pypy-commit mailing list