Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 17 additions & 16 deletions build/__native_faster_hexbytes.c
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
#ifndef DIFFCHECK_PLACEHOLDER
#define DIFFCHECK_PLACEHOLDER 0
#endif
#include "init.c"
#include "getargs.c"
#include "getargsfast.c"
#include "int_ops.c"
#include "float_ops.c"
#include "str_ops.c"
#include "bytes_ops.c"
#include "list_ops.c"
#include "dict_ops.c"
#include "set_ops.c"
#include "tuple_ops.c"
#include "exc_ops.c"
#include "misc_ops.c"
#include "generic_ops.c"
#include "pythonsupport.c"
#include "function_wrapper.c"
#include <init.c>
#include <getargs.c>
#include <getargsfast.c>
#include <int_ops.c>
#include <float_ops.c>
#include <str_ops.c>
#include <bytes_ops.c>
#include <list_ops.c>
#include <dict_ops.c>
#include <set_ops.c>
#include <tuple_ops.c>
#include <exc_ops.c>
#include <misc_ops.c>
#include <generic_ops.c>
#include <pythonsupport.c>
#include <function_wrapper.c>
#include "__native_faster_hexbytes.h"
#include "__native_internal_faster_hexbytes.h"
static PyMethodDef faster_hexbytesmodule_methods[] = {
Expand Down Expand Up @@ -4115,6 +4115,7 @@ CPyL125: ;
}
if (exec_faster_hexbytes__mypyc(module) < 0) {
Py_DECREF(module);
module = NULL;
return NULL;
}
return module;
Expand Down
37 changes: 36 additions & 1 deletion build/faster_hexbytes.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,42 @@ PyMODINIT_FUNC
PyInit_faster_hexbytes(void)
{
PyObject *tmp;
if (!(tmp = PyImport_ImportModule("faster_hexbytes__mypyc"))) return NULL;
// Use ImportModuleLevel with a non-empty fromlist so Python returns the
// leaf submodule via sys.modules lookup, avoiding the top-down getattr
// walk done by PyImport_ImportModule. That walk fails when the shim runs
// during a parent package's __init__.py, because the parent's submodule
// attribute isn't set until after __init__ returns.
static PyObject *fromlist = NULL;
if (!fromlist) {
fromlist = Py_BuildValue("(s)", "*");
if (!fromlist) return NULL;
}
tmp = PyImport_ImportModuleLevel("faster_hexbytes__mypyc", NULL, NULL, fromlist, 0);
if (!tmp) return NULL;
// Populate cross-group export tables lazily, just before we instantiate
// the per-module real init. Deferring this out of the shared lib's own
// PyInit keeps separate-mode compiled modules from recursively triggering
// sibling-package __init__.py mid-bootstrap.
// PyObject_GetOptionalAttrString would be cleaner, but it's 3.13+ and the
// shim deliberately #includes only <Python.h>, so we can't pull in the
// pythoncapi_compat.h shim from lib-rt here. AttributeError + PyErr_Clear
// is the portable form.
PyObject *deps_capsule = PyObject_GetAttrString(tmp, "ensure_deps");
if (deps_capsule != NULL) {
int (*deps_func)(void) = (int (*)(void))PyCapsule_GetPointer(
deps_capsule, "faster_hexbytes__mypyc.ensure_deps");
Py_DECREF(deps_capsule);
if (deps_func == NULL) {
Py_DECREF(tmp);
return NULL;
}
if (deps_func() < 0) {
Py_DECREF(tmp);
return NULL;
}
} else {
PyErr_Clear();
}
PyObject *capsule = PyObject_GetAttrString(tmp, "init_faster_hexbytes");
Py_DECREF(tmp);
if (capsule == NULL) return NULL;
Expand Down
37 changes: 36 additions & 1 deletion build/faster_hexbytes/_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,42 @@ PyMODINIT_FUNC
PyInit__utils(void)
{
PyObject *tmp;
if (!(tmp = PyImport_ImportModule("faster_hexbytes__mypyc"))) return NULL;
// Use ImportModuleLevel with a non-empty fromlist so Python returns the
// leaf submodule via sys.modules lookup, avoiding the top-down getattr
// walk done by PyImport_ImportModule. That walk fails when the shim runs
// during a parent package's __init__.py, because the parent's submodule
// attribute isn't set until after __init__ returns.
static PyObject *fromlist = NULL;
if (!fromlist) {
fromlist = Py_BuildValue("(s)", "*");
if (!fromlist) return NULL;
}
tmp = PyImport_ImportModuleLevel("faster_hexbytes__mypyc", NULL, NULL, fromlist, 0);
if (!tmp) return NULL;
// Populate cross-group export tables lazily, just before we instantiate
// the per-module real init. Deferring this out of the shared lib's own
// PyInit keeps separate-mode compiled modules from recursively triggering
// sibling-package __init__.py mid-bootstrap.
// PyObject_GetOptionalAttrString would be cleaner, but it's 3.13+ and the
// shim deliberately #includes only <Python.h>, so we can't pull in the
// pythoncapi_compat.h shim from lib-rt here. AttributeError + PyErr_Clear
// is the portable form.
PyObject *deps_capsule = PyObject_GetAttrString(tmp, "ensure_deps");
if (deps_capsule != NULL) {
int (*deps_func)(void) = (int (*)(void))PyCapsule_GetPointer(
deps_capsule, "faster_hexbytes__mypyc.ensure_deps");
Py_DECREF(deps_capsule);
if (deps_func == NULL) {
Py_DECREF(tmp);
return NULL;
}
if (deps_func() < 0) {
Py_DECREF(tmp);
return NULL;
}
} else {
PyErr_Clear();
}
PyObject *capsule = PyObject_GetAttrString(tmp, "init_faster_hexbytes____utils");
Py_DECREF(tmp);
if (capsule == NULL) return NULL;
Expand Down
37 changes: 36 additions & 1 deletion build/faster_hexbytes/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,42 @@ PyMODINIT_FUNC
PyInit_main(void)
{
PyObject *tmp;
if (!(tmp = PyImport_ImportModule("faster_hexbytes__mypyc"))) return NULL;
// Use ImportModuleLevel with a non-empty fromlist so Python returns the
// leaf submodule via sys.modules lookup, avoiding the top-down getattr
// walk done by PyImport_ImportModule. That walk fails when the shim runs
// during a parent package's __init__.py, because the parent's submodule
// attribute isn't set until after __init__ returns.
static PyObject *fromlist = NULL;
if (!fromlist) {
fromlist = Py_BuildValue("(s)", "*");
if (!fromlist) return NULL;
}
tmp = PyImport_ImportModuleLevel("faster_hexbytes__mypyc", NULL, NULL, fromlist, 0);
if (!tmp) return NULL;
// Populate cross-group export tables lazily, just before we instantiate
// the per-module real init. Deferring this out of the shared lib's own
// PyInit keeps separate-mode compiled modules from recursively triggering
// sibling-package __init__.py mid-bootstrap.
// PyObject_GetOptionalAttrString would be cleaner, but it's 3.13+ and the
// shim deliberately #includes only <Python.h>, so we can't pull in the
// pythoncapi_compat.h shim from lib-rt here. AttributeError + PyErr_Clear
// is the portable form.
PyObject *deps_capsule = PyObject_GetAttrString(tmp, "ensure_deps");
if (deps_capsule != NULL) {
int (*deps_func)(void) = (int (*)(void))PyCapsule_GetPointer(
deps_capsule, "faster_hexbytes__mypyc.ensure_deps");
Py_DECREF(deps_capsule);
if (deps_func == NULL) {
Py_DECREF(tmp);
return NULL;
}
if (deps_func() < 0) {
Py_DECREF(tmp);
return NULL;
}
} else {
PyErr_Clear();
}
PyObject *capsule = PyObject_GetAttrString(tmp, "init_faster_hexbytes___main");
Py_DECREF(tmp);
if (capsule == NULL) return NULL;
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools", "wheel", "mypy[mypyc]==2.0.0", "hexbytes==1.3.1"]
requires = ["setuptools", "wheel", "mypy[mypyc]==2.1.0", "hexbytes==1.3.1"]
build-backend = "setuptools.build_meta"

[tool.autoflake]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"build>=0.9.0",
"bump_my_version>=0.19.0",
"ipython",
"mypy==2.0.0",
"mypy==2.1.0",
"pre-commit>=3.4.0",
"tox>=4.0.0",
"twine",
Expand Down