Mercurial > cpython-lru_cache-weakref
annotate PC/example_nt/example.c @ 66978:aed2bbafa550 3.1
Blocked revisions 87324 via svnmerge
........
r87324 | r.david.murray | 2010-12-16 14:08:51 -0500 (Thu, 16 Dec 2010) | 9 lines
#10719: restore messages generated on invalid compileall args
Before the introduction of filename arguments to compileall it gave semi useful
messages about not being able to 'list' names that weren't valid directories.
This fix restores that behavior. In addition to the test for this case, the
patch also adds a test for the default behavior of compileall when no arguments
are provided, and fixes a bug in one of the previously added tests.
........
| author | R. David Murray <rdmurray@bitdance.com> |
|---|---|
| date | Thu, 16 Dec 2010 19:10:16 +0000 |
| parents | f197407bdba2 |
| children |
| rev | line source |
|---|---|
|
4223
180c1d3dac41
A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1 #include "Python.h" |
|
180c1d3dac41
A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2 |
|
180c1d3dac41
A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
3 static PyObject * |
|
13660
a1ce07218781
Miscelaneous ANSIfications. I'm assuming here 'main' should take (int,
Thomas Wouters <thomas@python.org>
parents:
4223
diff
changeset
|
4 ex_foo(PyObject *self, PyObject *args) |
|
4223
180c1d3dac41
A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
5 { |
|
61467
f197407bdba2
Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
50557
diff
changeset
|
6 printf("Hello, world\n"); |
|
f197407bdba2
Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
50557
diff
changeset
|
7 Py_INCREF(Py_None); |
|
f197407bdba2
Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
50557
diff
changeset
|
8 return Py_None; |
|
4223
180c1d3dac41
A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
9 } |
|
180c1d3dac41
A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
10 |
|
180c1d3dac41
A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
11 static PyMethodDef example_methods[] = { |
|
61467
f197407bdba2
Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
50557
diff
changeset
|
12 {"foo", ex_foo, METH_VARARGS, "foo() doc string"}, |
|
f197407bdba2
Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
50557
diff
changeset
|
13 {NULL, NULL} |
|
4223
180c1d3dac41
A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
14 }; |
|
180c1d3dac41
A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
15 |
|
50557
bd0e361bd642
Merged revisions 68169-68170 via svnmerge from
Georg Brandl <georg@python.org>
parents:
38669
diff
changeset
|
16 static struct PyModuleDef examplemodule = { |
|
61467
f197407bdba2
Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
50557
diff
changeset
|
17 PyModuleDef_HEAD_INIT, |
|
f197407bdba2
Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
50557
diff
changeset
|
18 "example", |
|
f197407bdba2
Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
50557
diff
changeset
|
19 "example module doc string", |
|
f197407bdba2
Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
50557
diff
changeset
|
20 -1, |
|
f197407bdba2
Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
50557
diff
changeset
|
21 example_methods, |
|
f197407bdba2
Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
50557
diff
changeset
|
22 NULL, |
|
f197407bdba2
Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
50557
diff
changeset
|
23 NULL, |
|
f197407bdba2
Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
50557
diff
changeset
|
24 NULL, |
|
f197407bdba2
Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
50557
diff
changeset
|
25 NULL |
|
50557
bd0e361bd642
Merged revisions 68169-68170 via svnmerge from
Georg Brandl <georg@python.org>
parents:
38669
diff
changeset
|
26 }; |
|
bd0e361bd642
Merged revisions 68169-68170 via svnmerge from
Georg Brandl <georg@python.org>
parents:
38669
diff
changeset
|
27 |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
13660
diff
changeset
|
28 PyMODINIT_FUNC |
|
50557
bd0e361bd642
Merged revisions 68169-68170 via svnmerge from
Georg Brandl <georg@python.org>
parents:
38669
diff
changeset
|
29 PyInit_example(void) |
|
4223
180c1d3dac41
A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
30 { |
|
61467
f197407bdba2
Recorded merge of revisions 81032 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
50557
diff
changeset
|
31 return PyModule_Create(&examplemodule); |
|
4223
180c1d3dac41
A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
32 } |
