forked from python/mypy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test to actually reproduce python#5784
- Loading branch information
1 parent
9c577e6
commit 146c26b
Showing
6 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include <Python.h> | ||
|
||
// Function 1: A simple 'hello world' function | ||
static PyObject* helloworld(PyObject* self, PyObject* args) | ||
{ | ||
printf("Hello World\n"); | ||
return Py_None; | ||
} | ||
|
||
// Our Module's Function Definition struct | ||
// We require this `NULL` to signal the end of our method | ||
// definition | ||
static PyMethodDef myMethods[] = { | ||
{ "helloworld", helloworld, METH_NOARGS, "Prints Hello World" }, | ||
{ NULL, NULL, 0, NULL } | ||
}; | ||
|
||
// Our Module Definition struct | ||
static struct PyModuleDef myModule = { | ||
PyModuleDef_HEAD_INIT, | ||
"hello", | ||
"Test Module", | ||
-1, | ||
myMethods | ||
}; | ||
|
||
// Initializes our module using our above struct | ||
PyMODINIT_FUNC PyInit_hello(void) | ||
{ | ||
return PyModule_Create(&myModule); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from setuptools import setup, Extension | ||
|
||
setup( | ||
name='typedpkg_c_ext', | ||
version='1.0', | ||
packages=['typedpkg_c_ext'], | ||
ext_modules=[Extension('typedpkg_c_ext.hello', ['hello.c'])], | ||
zip_safe=False, | ||
package_data={ | ||
'typedpkg_c_ext': ['py.typed'] | ||
}, | ||
) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from . import hello | ||
|
||
|
||
def speak() -> None: | ||
hello.helloworld() |
Empty file.